Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Sort an array which contains date formatted elements

by dsheroh (Prior)
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://627049]
and the daffodils sway...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2018-03-17 04:48 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (223 votes). Check out past polls.