By default sort uses string comparisons. By using <=> you tell it to compare the values as numbers.my @ordered = reverse sort { $a <=> $b } @dports; # or my @ordered = sort { $b <=> $a } @dports; print "@ordered";
In reply to Re: Predefined Sort
by pc88mxer
in thread Predefined Sort
by k_grdn
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |