use Sub::Name; sub AUTOLOAD { my ($name) = (our $AUTOLOAD =~ /(\w+)$/); my $func = subname $name => sub { ...; # this is where the work happens }; no strict 'refs'; *$name = $func; goto $func; }