Mega Code Archive

 
Categories / Perl / Array
 

Using = operator in array sort function

#!/usr/bin/perl -w use strict; my @unsorted = (1, 2, 11, 24, 3, 36, 40, 4); my @number = sort { $a <=> $b } @unsorted; print "Numeric sort:  @number\n";