該代碼爲自己說話,沒有使用代碼排序,因爲我不知道您的使用這是Perl中的內容代碼。在/ home/delkav /實驗室的腳本/ grep的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"
內容是:
$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
嗯,謝謝你的幫助。
它是完美的,謝謝!非常簡單的你的代碼。 – opmeitle 2012-07-31 16:13:08