in reply to Re: goto with some arguments
in thread goto with some arguments

While it's probably true that unconditional jumps should be avoided, I'm not against goto "a priori". And, since we're talking about Perl's goto, a mention of the goto &NAME idiom is in order:
use strict; use warnings; use vars qw/$AUTOLOAD/; sub AUTOLOAD { $AUTOLOAD =~ /.*::(.*)/; my $name = $1; print "It looks like you're trying to call $name...\n"; no strict 'refs'; *{ "main::$name" } = sub { print "Hey, I've been called by ", (caller)[0], ", and here my arguments: @_\n"; }; goto &{ "main::$name" }; # The brand new sub can't realize it has # been actually called from somewhere # else } foo( "Hello", "World" ); foo( "Howdy, world" ); # I call foo() again, this time it exists sub bar { foo( "See you, world" ); } bar();