Besides the push solution, you can also print to a filehandle that has been opened to an in-memory variable:
my $output; open my $fd, '>', \$output or die "open: $!"; ## print to the $output scalar print $fd "hello\n"; print $fd "world\n"; close $fd; ## use results print $output; __END__ hello world
--
David Serrano
In reply to Re: print to data
by Hue-Bond
in thread print to data
by Yoda_Oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |