If you can then ditch the unsortable date format. Otherwise just transform the date before the sort and use the ISO format internally. Using non ISO compliant dates in computer software is inherently evil so doing this will be a net improvement (IMO) to your code. The sooner these regional date formats go the way of the steam engine the better. Something like the following regex should do it:
With this representation used internally you can use lexicographical sorting on the keys of the hash. Ie:
my @sorted=sort keys %hash;
Alhough even here you are introducing year 10000 incompatibilities. If that worries you then you should use some other technique like the Swartzian Transform. Me, I tend to think that if they are still using my code 7000 years from now they deserve what they get.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||