Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Re: Re: Speeding up sort routines

by lhoward (Vicar)
on Jul 02, 2001 at 19:53 UTC ( #93215=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Speeding up sort routines
in thread Speeding up sort routines

You're going to want to parse the date format into something nicer before you compare them. Comparing them as they are will not give the results you want:

Comparing "Jan 15, 2000" to "Apr 12, 2001" with cmp will tell you that the April, 2001 date is before the Jan 2000 date.

My preference would be to combine the date and timestamp and convert it to a unix timestamp (seconds since Jan 1, 1970). Then you can just compare the timestamps numericly. I like to use Time::ParseDate for these types of conversions.

Also, using split instead of the regular expression for your IP #'s will probably be quicker.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2019-08-24 18:46 GMT
Find Nodes?
    Voting Booth?

    No recent polls found