use strict; use warnings; use Perl; my $p = Perl->new; my $data = $p->eval(q{ do{ use IO::Scalar; my $result; tie *STDOUT, 'IO::Scalar', \$result; print 'some stuff'; $result; } }); print "|||$data|||\n";
If you want to run a perl script change the print line to do 'somefile.pl';
In reply to Re: Challenge: Capturing stdout from a function call.
by eclark
in thread Challenge: Capturing stdout from a function call.
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |