stephanm has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
maybe someone can help me understanding why "die" does not die when it's called within a file that in turn is called with a do statement.
I've created 2 files, calling.pl and called.pl as per below. The output of perl -w calling.pl is given underneath. It seems the "die" statement in called.pl does not get executed.
Can anybody help?
Thanks.
calling.pl:
do 'called.pl':; print "printing from calling program\n"; die "dying from calling program, stopped";
called.pl:
print "printing from called program\n"; print STDERR "printing from called program to stderr\n"; die "dying from called program, stopped";
output:
printing from called program printing from called program to stderr printing from calling program dying from calling program, stopped at calling.pl line 3.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using "die" with "do-file"
by Your Mother (Archbishop) on Jul 06, 2008 at 06:55 UTC | |
by stephanm (Sexton) on Jul 06, 2008 at 09:56 UTC | |
|
Re: Using "die" with "do-file"
by apl (Monsignor) on Jul 06, 2008 at 11:55 UTC |