Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
alakaboo mentions Date::Manip which is an excellent module but is very much a heavyweight module (in fact, the POD for Date::Manip even recommends not to use it if you're looking for simple date transformations of the form you're looking for). Try using Time::ParseDate which is much more lightweight and does exactly what you're looking for too much else. Combine it with a Schwartzian transform (see merlyn's post above) like so:
use Time::Parsedate; ... foreach my $day ( map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, parsedate( $_ ) ] } @dates ) { ... }
And that will be all she wrote. parsedate() from Time::Parsedate is pretty speedy and comparing the dates using a simple numeric compare is probably going to be faster than using Date_Cmp() (parsedate() returns numeric timestamps).

In reply to Re: sorting mm/dd/yy by Hrunting
in thread sorting mm/dd/yy by electronicMacks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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:
    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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (5)
    As of 2021-01-17 13:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?