in reply to
Redirect STDOUT to a $variable
I found that this works: sub print_to_var { my ($m, $v) = @_; local *STDOUT; open(STDOUT, ">", \$v); print $m; return $v; } #returns variable which contains string of $m printed
Comment on
Re: Redirect STDOUT to a $variable
In Section
Seekers of Perl Wisdom