in reply to Sorting a File which contains numbers
Check out the pages on sort, reverse, and split for more information. There are certainly shorter ways to do this, but you need to understand what's going on before you can condense it.for my $line (<FH>) { my @unsorted = split / /, $line; # sort ascending my @sorted = sort @unsorted; # sort descending my @desc_sort = reverse @sorted; }
|
|---|