Thursday, July 09, 2009

numeric sort perl

# sort numerically ascending
@articles = sort {$a <=> $b} @files;

# sort numerically descending
@articles = sort {$b <=> $a} @files;

http://www.misc-perl-info.com/perl-sort.html

http://stackoverflow.com/questions/2379315/perl-access-a-hashref-sorted-by-value


Labels: , ,

0 Comments:

Post a Comment

<< Home