Merrill, you mean "set up exception handlers", not "step up", right? (Could
confuse newbie.)
Also, why not mention using 'return' to "escape" from a function? You can
use 'return' any
And, Dave, you can & should read about 'return' in the perlsub manpage and
about 'die' in the perlfunc manpage.
Try this:
-----------------------------------------------------------------
for (1..10) {print "$_ is ", even_or_odd(), ".\n";}
sub even_or_odd{
return "odd" if ($_ % 2);
return "even";
}
It prints:
1 is odd.
2 is even.
3 is odd.
4 is even.
5 is odd.
6 is even.
7 is odd.
8 is even.
9 is odd.
10 is even.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Cornish, Merrill
Sent: Tuesday, January 09, 2001 12:18 PM
To: Dave Navarro; [EMAIL PROTECTED]
Subject: RE: Perl question
die() throws an exception. If there is nothing there to catch that
exception, then the program ends. If there is an exception handler, then
the die() can be stopped there, such as at the function call. You use eval()
to step up exception handlers.
If, however, you are merely looking for an escape from a function, then
create a block in the function, label it, then use last <label> to escape to
the end of that labeld block.
Merrill
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users