Re: Print to several logs

2013-08-28 Thread Shawn H Corey
On Wed, 28 Aug 2013 12:34:40 -0400 Harry Putnam wrote: > Good thinking thanks. It might not really apply here though. > I'm no kind of data manager... just a homeboy hillbilly. > > What I had in mind is writing to a single log file that is dated on > the file name for each run of the program.

Re: Print to several logs

2013-08-28 Thread Rob Dixon
On 28/08/2013 19:06, John W. Krahn wrote: Rob Dixon wrote: use strict; use warnings; use autodie; my $rsync = 'rsync'; my $tmplog = 'one.log'; my $tmplog2 = 'two.log'; my %logs = map { open my $FH, '>>', $_; What if open fails?! I have `use autodie`. Rob -- To unsubscribe, e-mail: begi

Re: Make a sub routine return

2013-08-28 Thread Rob Dixon
On 28/08/2013 16:48, Harry Putnam wrote: The code below was a script by itself but now I need to turn it into a function inside a larger script... I've done something that sort of works but fails on a specific file name that looks like `.#somefile'. What does "fails" mean? Does it crash?, prod

Re: Print to several logs

2013-08-28 Thread John W. Krahn
Rob Dixon wrote: On 27/08/2013 23:06, John W. Krahn wrote: my %logs = ( 'one.log' => undef, 'two.log' => undef, ); for my $name ( keys %logs ) { open my $FH, '>>', $name or die "Cannot open '$name' because: $!"; $logs{ $name } = $FH; } for my $log_FH ( values %logs ) { print $log_FH "kdkdkdk

Re: Print to several logs

2013-08-28 Thread Shawn H Corey
On Wed, 28 Aug 2013 12:34:40 -0400 Harry Putnam wrote: > That sounds quite a bit like what cron could do with this hmm. Or use a hard link to preserve the file. -- Don't stop where the ink does. Shawn -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional c

Re: Print to several logs

2013-08-28 Thread Harry Putnam
Shawn H Corey writes: > On Wed, 28 Aug 2013 10:42:30 -0400 > Harry Putnam wrote: > >> Thanks to all other posters.. lots of good input. > > It seems to me that recording the same information is many places is a > design flaw. If you have the same information in two or more places, it > will get

Make a sub routine return

2013-08-28 Thread Harry Putnam
I know the format and scripting are probably pretty backwards but I seem to recall it being important to have a `return' line in a function. The code below was a script by itself but now I need to turn it into a function inside a larger script... I've done something that sort of works but fails o

Re: Print to several logs

2013-08-28 Thread Shawn H Corey
On Wed, 28 Aug 2013 10:42:30 -0400 Harry Putnam wrote: > Thanks to all other posters.. lots of good input. It seems to me that recording the same information is many places is a design flaw. If you have the same information in two or more places, it will get out of sync. Write the program that w

Re: Print to several logs

2013-08-28 Thread Harry Putnam
Rob Dixon writes: > On 27/08/2013 23:06, John W. Krahn wrote: >> Harry Putnam wrote: [...] >>> (Simplified for discussion, from a longer script) >>> >>>my $rsync = 'rsync'; >>>my $tmplog = 'one.log'; >>>my $tmplog2 = 'two.log'; >>>open(LOG,">>$tmplog")or die "Can't open $tmplog