mr.nick has asked for the wisdom of the Perl Monks concerning the following question:
Oh, and it can't used a file for temporary storage (yes, it would be easy enough to redirect STDOUT to a /tmp/foobar.$$ file and snarf it back in, but this approach isn't possible in the actual situation).my $hello='print "Goodbye System!"'; my $result=special_eval $hello; print $results; # which would print "Goodbye System"
For background, the purpose of this is to provide a mechanism for a person to write a Perl script that behaves the same whether you are running it from a command line or having a shell-type program execute it for you.
intrigued... me
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: Redirecting STDOUT to a variable via eval?
by tilly (Archbishop) on Feb 12, 2001 at 08:52 UTC | |
by mr.nick (Chaplain) on Feb 12, 2001 at 09:51 UTC | |
by tilly (Archbishop) on Feb 12, 2001 at 10:20 UTC |