#! perl -w unshift @array, $_ for 1..20; @array3=sort({($b/5) <=> ($a/5)}@array); foreach (@array3) { print "$_ "; }