in reply to Challenge: Capturing stdout from a function call.
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';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Challenge: Capturing stdout from a function call.
by BUU (Prior) on Oct 22, 2004 at 20:51 UTC |