in reply to How to redirect STDOUT to an array (not executing program)
Beware that this does work for STDOUT in child processes.my $var; close STDOUT; open(STDOUT, '>', \$var) || die "Unable to open STDOUT: $!"; print "Hollow World\n"; print "And another\n"; close (STDOUT); my @data = split "\n", $var; local $" = '|'; print STDERR "<@data>\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to redirect STDOUT to an array (not executing program)
by rapide (Beadle) on Jan 18, 2009 at 12:57 UTC |