http://qs321.pair.com?node_id=654098


in reply to subroutine refs

It is likely that the application can (and perhaps should) be rearchitected, but let's not go there. In addition to the suggestions above, one quirky way would be to use OO syntax, but that would add an argument to all your sub definitions. For example:
use strict; use warnings; my $meth_name = 'foo'; __PACKAGE__->$meth_name('camel'); exit( 0 ); sub foo { my ($self, $arg) = @_; print "$arg (on behalf of $self)\n"; }

which prints

camel (on behalf of main)