In Perl, you do it the same.
my $logfile = 'file.txt'; open my $log_fh, '>>', $logfile or die "Couldn't open '$logfile': $!"; sub print_sub { my ($log) = @_; print {$log} "Starting work\n"; }; ... print_sub($log_fh);
But maybe you want Log::Log4perl?
In reply to Re: Printing to a File from Sub
by Corion
in thread Printing to a File from Sub
by PyrexKidd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |