Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-10-24 06:40 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (286 votes). Check out past polls.