Perl Language Sorting Numeric Sort


Example

@sorted = sort { $a <=> $b } @list;

Comparing $a and $b with the <=> operator ensures they are compared numerically and not textually as per default.