> > Is there any decent documentation available that I could study so > > that I can sort this better? > >
As soon as I hit Send on this email I checked my 'Learning Perl' book and found some information (Ch. 15, not that far yet ;^)). Prior to implementing anything, I want to understand what's going on. > > I thought about grabbing the ctime of each file and sorting on that > > but I'm not sure if that would add unnecessary complexity to the > > script. > > > > Incidentally, these files are created by SARG (Squid log analyzer) and > > I've found nothing in the config that lets me customize the naming > > convention for the directories. > > > > ry > Here is one way to approach: > !perl > > use strict; > use warnings; > > my %AlphaToNbr = qw(jan 1 feb 2 mar 3 apr 4 may 5 jun 6 jul 7 aug 8 sep 9 > oct 10 nov 11 dec 12); > foreach my $MySortedFile (sort { $a->[1] <=> $b->[1] > or > $AlphaToNbr{lc($a->[2])} <=> $AlphaToNbr{lc($b- > >[2])} or > $a->[3] <=> $b->[3] > } > map {[$_, /^.(\d{4})(\w{3})(\d{2})/]} > <DATA> ) { > chomp($MySortedFile->[0]); > print $MySortedFile->[0] . "\n"; > } > > __DATA__ > /2005Jul01-2005Jul02/foo/bar.html > /2005Jul05-2005Jul06/foo/bar.html > /2005Jun09-2005Jun10/foo/bar.html > /2005Jun10-2005Jun11/foo/bar.html > /2005Jun13-2005Jun14/foo/bar.html > /2005Jun14-2005Jun15/foo/bar.html > > Output: > /2005Jun09-2005Jun10/foo/bar.html > /2005Jun10-2005Jun11/foo/bar.html > /2005Jun13-2005Jun14/foo/bar.html > /2005Jun14-2005Jun15/foo/bar.html > /2005Jul01-2005Jul02/foo/bar.html > /2005Jul05-2005Jul06/foo/bar.html > > Wags ;) Thanks for the snippet; I'll dig into this to learn more! ry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>