Guest_imported
New member
- Jan 1, 1970
- 0
I need sort a flat file on one field. Seems like very simple, but it doesn't work for me. When i print out the datafile, the sorted file is same as the original one. I have no idea what i did wrong. Please help!! Thanks!
the following is my script:
my @data;
while ($line = <IN>){
push @data, ( split(/\[\w*\]+/, $line)) ;
}
print "@data<br>\n";
my @sorted = sort{$a->[1] <=> $b->[1]} @data ;
print "@sorted\n";
the following is my script:
my @data;
while ($line = <IN>){
push @data, ( split(/\[\w*\]+/, $line)) ;
}
print "@data<br>\n";
my @sorted = sort{$a->[1] <=> $b->[1]} @data ;
print "@sorted\n";