Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Building a log file

by si_lence (Deacon)
on Jun 23, 2009 at 14:56 UTC ( #774048=note: print w/replies, xml ) Need Help??


in reply to Building a log file

I'm not sure I understand your problem.

You can open your log-file at the start of your program and just write to it with the print statements:

my $logfile = 'path/to/logfile.txt'; open(LOG, "> $logfile") or die "could not open log-file: $!"; print LOG "this is a log entry\n";

If you need to see your log output immediately be aware of buffering issues ...

cheers

si_lence

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://774048]
help
Chatterbox?
shmem doesn't have mp3info, but mp3info2 - which is a perl script ;-)
[marioroy]: my @music_times = qx(find \$HOME/Music/ Albums/ -type f -iname '*.mp3' -exec mp3info -p "%S\\\n" {} \\;);
[marioroy]: might need 2 or 3 backslash for \n. Also \\;
[Lady_Aleena]: shmem, there is MP3::Info/
[Discipulus]: too much complex qx when you know perl are better to avoid
[marioroy]: might need to backslash \'*.mp3\'
[marioroy]: It's a quoting issue inside qx. It's File::Find or qx. LA chooses qx. Almost there.
[marioroy]: Also \"%S\\\n\" oh my, not fun.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2017-04-23 21:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.