in reply to Re^2: sorting keys in hash
in thread sorting keys in hash

You are only repeating not explaining. :(

I'm out! :)

update

If 13 means the year and not the day this could be indeed chronological. (?)

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^4: sorting keys in hash
by LanX (Saint) on May 23, 2014 at 16:50 UTC
    horrible data structure ... :(

    use warnings; use strict; use Data::Dump; my @unsorted =qw( Dec02 Jan02 May05 Dec01 Apr05 May15 ); my @sorted= sort datesort @unsorted; dd \@unsorted,\@sorted; my @months= qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my %month_order; @month_order{@months} = 1..12; #dd \%month_order; sub datesort { my ($am,$ay) = $a =~ /(\w\w\w)(\d\d)/; my ($bm,$by) = $b =~ /(\w\w\w)(\d\d)/; return $ay <=> $by or $month_order{$am} <=> $month_order{$bm}; }

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Re^4: sorting keys in hash
by Perlseeker_1 (Acolyte) on May 23, 2014 at 16:17 UTC
    Hi,

    As I mentioned I don't want to display the output in alphabetic order, need to display the output as sorted months if key is MAR14 --> 02,MAY14 --> 02,APR14,DEC13--> 02 --> 02

    expecting the output in sorted months as DEC13--> 02,MAR14 --> 02,APR14-->,MAY14 --> 02

    Thanks J