No such thing as a small change | |
PerlMonks |
Re: Counter that won't work with the IP Logby mitd (Curate) |
on Nov 15, 2001 at 14:08 UTC ( [id://125539]=note: print w/replies, xml ) | Need Help?? |
No, No, my friend read Kanji first line -M is a FILE Operator It works on FILES not scalars. Also Kanji is a little confused in his use of localtime(time).
localtime(time) in an array context returns a list of time elements ($sec,$min ...), In your case you are using it in a scalar context in which case it returns a formatted time string ( Thu Nov 15 03:32:13 2001 ). If this is what you want your delta date calculations will probably need the assistance of a perl module like Date::Calc. But there is an easier way that Kanji's example although not quite right, illustrates.
Your timestamps will now be in system time format but a simple three liner (hey using localtime() ) can coerce them back into human readable format. Lastly you can vastly simplify your script by going to your favorite Perl reference and first reading about hashes and then reading about many options for 'tieing' external hashes. Here's a teaser.
good luck
mitd-Made in the Dark
In Section
Seekers of Perl Wisdom
|
|