No such thing as a small change | |
PerlMonks |
Sort files descending by dateby Scrat (Monk) |
on Jun 19, 2007 at 07:30 UTC ( [id://621961]=perlquestion: print w/replies, xml ) | Need Help?? |
Scrat has asked for the wisdom of the Perl Monks concerning the following question: Hi Everyone I have a list of xml files in 'n directory: The above filenames contain the following (taking the first file as an example): WAN_DX_ACD_ACD - This is the network device name 2007_06_10 - This is the date (yyyy-mm-dd) 00_10_38_042 - This is the time including milliseconds(00:10:38:042 AM) I need to sort these files descendingly according to date and then time (process the oldest files first, and the newest files last). This is my code, which doesn't work:
When I print @sorted_list, the contents are still not sorted. What am I doing wrong? Update:Fixed typo. Update2:Just realised another mistake - I was printing the old unsorted @file_list in my initial 2nd foreach loop, and not the new, sorted @sorted_list.
Back to
Seekers of Perl Wisdom
|
|