Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Rolling over a Parser File

by FunkyMonk (Canon)
on Aug 08, 2011 at 15:22 UTC ( #919253=note: print w/ replies, xml ) Need Help??


in reply to Rolling over a Parser File

Make sure the filename is based on the current date and always open for each write. Something like

sub loggit { my @gmt = gmtime; my $date = sprintf "%04d%02d%02d", $gmt[5]+1900, $gmt[4]+1, $gmt[3 +]; my $file = "$date.log"; open my $log, ">>", $file or die $!; print $log, @_; close $log; }


Comment on Re: Rolling over a Parser File
Download Code
Re^2: Rolling over a Parser File
by ahuang14 (Novice) on Aug 08, 2011 at 18:18 UTC
    Right but how do I get my computer to create a new file every day? this is saying that on $date log everything to that file, which is what I want, but how does my computer know to create a new file everyday that this code can be run on?
      never mind I got it to work. Thanks alot!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-12-26 22:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls