in reply to Printing to a File from Sub
Of course, if your code is OO you could also store the filehandle in the object to prevent the need for passing it around, even better create a method to retrieve the fh that created it on the first request. Perl filehandles when create as Corion exhibited can be passed around like any scalar, pretty much. Or you could even create a closure to handle all prints:
As always, TIMTOWTDI :){ my $fh; open($fh,'>',$file); sub print_to_fh { print $fh @_; } }
In Section
Seekers of Perl Wisdom