jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
This is a bit of a shot in the dark, but I was wondering if any of you knew how to overload a print statement to print to both a file and the screen?
Right now I am duplicating the print statements, ie print "hi\n"; print LOG "hi\n"; and that not only looks ugly, it is really bothersome for making changes to much of anything.
I could just run it | tee but I was really hoping for a nice pretty idiot proof way of doing it in perl that lets code changes be less frustrating.
Ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print to the screen and a log at the same time?
by philcrow (Priest) on May 09, 2006 at 15:26 UTC | |
|
Re: Print to the screen and a log at the same time?
by blazar (Canon) on May 09, 2006 at 15:26 UTC | |
|
Re: Print to the screen and a log at the same time?
by punkish (Priest) on May 09, 2006 at 15:28 UTC | |
by ikegami (Patriarch) on May 09, 2006 at 15:59 UTC | |
|
Re: Print to the screen and a log at the same time?
by ruzam (Curate) on May 09, 2006 at 16:13 UTC | |
|
Re: Print to the screen and a log at the same time?
by QM (Parson) on May 09, 2006 at 23:05 UTC |