The only hard part is converting the date to a format that can be easily searched. This can be done with a date conversion module (see above) or directly with a regex or split:
use strict; my %data; foreach (<DATA>) { split(/ => /, $_); $data{@_[0]} = @_[1]; } ####### my %months = ('Jan' => '01', 'Feb' => '02', 'Mar' => '03', 'Apr' => '04', 'May' => '05', 'Jun' => '06', 'Jul' => '07', 'Aug' => '08', 'Sep' => '09', 'Oct' => '10', 'Nov' => '11', 'Dec' => '12'); foreach (keys %data) { $data{$_} =~ /\w+ (\w+) (\d+) (\d+):(\d+):(\d+) (\d+)/; $data{$_} = [$6.$months{$1}.sprintf('%02d', $2).$3.$4.$5, $data{$_ +}]; } foreach (sort {$data{$b}->[0] <=> $data{$a}->[0]} keys %data) { print $_ . ' => ' . $data{$_}->[1]; } ####### __DATA__ index.html => Mon Oct 11 00:08:11 2004|12963 screenshot.jpg => Sun Oct 10 13:18:30 2004|234997 legal.html => Mon Oct 11 12:57:03 2004|13448 stylesheet.css => Mon Oct 11 13:57:28 2004|697 about.html => Mon Oct 11 00:08:08 2004|13225 archive.html => Mon Oct 11 00:08:09 2004|12872 postinfo.html => Fri Oct 1 23:49:15 2004|2457 contact.shtml => Mon Oct 11 00:09:48 2004|11366 services.html => Mon Oct 11 00:08:17 2004|14256 metatags.pl => Mon Oct 11 14:05:44 2004|28668 tools.html => Mon Oct 11 15:35:47 2004|14632 robots.txt => Sat Oct 9 03:35:15 2004|73 _vti_inf.html => Fri Oct 1 23:49:15 2004|1754 report.shtml => Mon Oct 11 00:07:03 2004|11686

In reply to Re: sorting a split hash by TedPride
in thread sorting a split hash by coldfingertips

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, details, 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, summary, 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.