in reply to Sort textfile
Sort returns the array sorted, it does not sort it in place. So just move your sort into the foreach
foreach my $line(sort @resultArray){Now it uses the sorted array returned from the sort. Alternately you could modify your sort line to save that back into the orignal array.
@resultArray = sort { $a<=>$b } @resultArray;Could anyone comment as to why sort doesn't do an inplace sort when called in void context?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Sort textfile
by chromatic (Archbishop) on Apr 13, 2004 at 21:18 UTC |