Re: Print to several logs

2013-08-27 Thread Michael Brader
There are some good answers here so far, but I'd like to recommend a logging module like Log::Log4perl. If your script is more than a run-once throwaway, proper logging will almost certainly be of benefit. Metacpan: https://metacpan.org/module/Log::Log4perl FAQ: http://log4perl.sourceforge.net

Re: Print to several logs

2013-08-27 Thread Nathan Hilterbrand
Jim, *much* better. I did a search for something like that before I wrote what I did, but I guess I didn't get the search terms right, because I didn't find it. Very cool Nathan > > On Aug 27, 2013, at 2:14 PM, Harry Putnam wrote: > >> >> I happen to be scripting something that needs to have

Re: Print to several logs

2013-08-27 Thread Rob Dixon
On 27/08/2013 23:06, John W. Krahn wrote: Harry Putnam wrote: I happen to be scripting something that needs to have two logs written to and was sort of taken by how awkward this construction looked: (Simplified for discussion, from a longer script) my $rsync = 'rsync'; my $tmplog = 'one

Re: Print to several logs

2013-08-27 Thread Jim Gibson
On Aug 27, 2013, at 2:14 PM, Harry Putnam wrote: > > I happen to be scripting something that needs to have two logs written > to and was sort of taken by how awkward this construction looked: > (snipped) Check out the IO::Tee module from CPAN. I have not used it, but it is mentioned in severa

Re: Print to several logs

2013-08-27 Thread Nathan Hilterbrand
See reply below, please > > I happen to be scripting something that needs to have two logs written > to and was sort of taken by how awkward this construction looked: > > (Simplified for discussion, from a longer script) > > my $rsync = 'rsync'; > my $tmplog = 'one.log'; > my $tmplog2 = 't

Re: Print to several logs

2013-08-27 Thread John W. Krahn
Harry Putnam wrote: I happen to be scripting something that needs to have two logs written to and was sort of taken by how awkward this construction looked: (Simplified for discussion, from a longer script) my $rsync = 'rsync'; my $tmplog = 'one.log'; my $tmplog2 = 'two.log'; open(

Print to several logs

2013-08-27 Thread Harry Putnam
I happen to be scripting something that needs to have two logs written to and was sort of taken by how awkward this construction looked: (Simplified for discussion, from a longer script) my $rsync = 'rsync'; my $tmplog = 'one.log'; my $tmplog2 = 'two.log'; open(LOG,">>$tmplog")or die "Ca