in reply to Re: Re: Sort textfile
in thread Sort textfile
(1) sort @array
does not sort the array, it returns the sorted array
(2) sort {$a <=> $b} @array
sorts numbers, not strings.
To fix this, use default sorting of sort (or explicitly compare strings) and assign it to a new array.
or@sorted = sort @array;
@sorted = sort {$a cmp $b} @array;
Sandy
|
|---|