hOURS wrote:
>
> Thanks to John and Tom for suggesting "do" and "eval". I read up on those.
> I don't understand them entirely, but I experimented. They seem to
> accomplish about the same thing. I wrote two one-line programs: print
> eval(system('perl -c nextprogramtoexecute.pl')); and
> print do {system('perl -c nextprogramtoexecute.pl')};
> They both give the same results.
perldoc -f do
[snip]
Manual error checking can be done this way:
# read in config files: system first, then user
for $file ("/share/prog/defaults.rc", "$ENV{HOME}/.someprogrc")
{
unless ($return = do $file) {
warn "couldn’t parse $file: $@" if $@;
warn "couldn’t do $file: $!" unless defined $return;
warn "couldn’t run $file" unless $return;
}
}
So for your example:
my $return = do 'nextprogramtoexecute.pl';
# etc.
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>