DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Sort By Month Name In Perl
Sort by month name
#!/usr/bin/perl -w
#
#
#
use strict;
my @mon = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
my $mon;
@{$mon}{@mon} = (0..$#mon);
my @data = ('Aug', 'Nov', 'Jun');
sub by_month {
$mon->{$a} <=> $mon->{$b};
}
print join $/, (sort by_month @data);
print $/;





