in reply to Predefined Sort

Try:
my @ordered = reverse sort { $a <=> $b } @dports; # or my @ordered = sort { $b <=> $a } @dports; print "@ordered";
By default sort uses string comparisons. By using <=> you tell it to compare the values as numbers.