in reply to how to get value of print command
Maybe this is what you want:
open( STDOUT, '>', \( my $output ) )
or die "Can't open in-memory file: $!";
print "Hello world!\n"; # prints to $output
print STDERR 'STDOUT: ' . $output;
STDOUT: Hello world!
Electric eels were invented at the same time as electricity
Before electricity was invented, electric eels had to stun with gas
Results (366 votes). Check out past polls.