On 11/24/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote:

The trick is I can't seem to goto() return in
do_some_stuff_and_return(), I'm sure since its so deep down...

I guess I'm totally confused; I don't see how a goto can return back
to the sub-rotine that called it:

#! perl -w

use strict;

my $global = 99;

&main();
# The below goto returns here -- not back to the sub-routine.
print "Primary: Did I catch the new value $global?\n";

exit;

sub main() {
 print "Main0: \$global is $global\n";
 goto &the_goto if $global =~ /99/; # Goto does NOT return back here...

 $global = 60;
 print "Main1: Did I catch the new value $global?\n";
}

sub the_goto() {
 print "Goto0: \$global is $global\n";
 $global = 0;
}

__END__

The use of goto in this content is like using AUTOLOAD which causes
the called routine to not return back to where it was called from but
actually continue at the point AFTER the previous routine -- a little
confusing to us beginners.

HTH!  =)
--
WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to