in reply to Recursively changing STDOUT
print STDOUT $foo;
somewhere? Or are you just printing to "the default filehandle" as in
print $foo;
without specifiying it?
If the latter is the case, you'll probably be better of with select and using lexical filehandles.
sub prepare_foo_print { my ($foo, $file) = @_; open my $fh, '>>', $file or die "bummer: $!\n"; my $oldfh = select $fh; # currently opened $file now is default filehandle # (instead of STDOUT) print_whatever ($foo); select $oldfh; } sub print_whatever { print shift; }
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|