代码不言自明,没有在代码中使用排序,因为我不知道你的用途这是 perl 中的内容代码。
/bash/perl
%ttys = ();
my @lsarray = `cat /home/delkav/labs-scripts/grep`;
my @array;
$array[0] = <STDIN>; < ONE
$array[1] = <STDIN>; < TWO
$array[2] = <STDIN>; < TRHEE
$array[3] = <STDIN>; < FOUR
$array[4] = <STDIN>; < FIVE
$array[5] = <STDIN>; < SIX
$array[6] = <STDIN>; < SEVEN
$array[7] = <STDIN>; < EIGHT
$array[8] = <STDIN>; < NINE
@ttys{@lsarray} = @array;
print "@{[%ttys]}\n"
/home/delkav/labs-scripts/grep 中的内容是:
$90850
$0
$389
$469
$670
$750
$684
$21744
$604
打印出脚本
$684
SEVEN
$469
FOUR
$21744
EIGHT
$670
FIVE
$389
TRHEE
$90850
ONE
$0
TWO
$750
SIX
$604
NINE
我需要输出如何。
$90850
ONE
$0
TWO
$389
THREE
$469
FOUR
$670
FIVE
$750
SIX
$684
SEVEN
$21744
EIGHT
$604
NINE
嗯,谢谢你的帮助。