Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Sort an array which contains date formatted elements

by dsheroh (Parson)
on Jul 17, 2007 at 15:39 UTC ( #627049=note: print w/ replies, xml ) Need Help??


in reply to Sort an array which contains date formatted elements

snopal beat me to the suggestion of using filesystem data to sort them correctly.

The reason that "it is taking the elements as strings even though i gave it to sort in numerical way" is because the filenames start with text, not numbers. If they were formatted as 7_jul_2007_webadmin.log, then your sort idea would have worked (until 1_aug_webadmin.log, at least - any change of month would break it) but, with the current filename formatting, all of the filenames have a numerical value of 0, so sorting them numerically doesn't do much.


Comment on Re: Sort an array which contains date formatted elements
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://627049]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (18)
As of 2014-10-30 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls