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


in reply to use slack;

I hate to turn off strict. Why use strict if you are only going to turn it off ?

I usually do this:

use strict; sub foo { print "bar\n" } my $func = "foo"; my $func_ref = \&{$func}; $func_ref->();
The reason this works is because the construct \&{$func} is exempt from the rule of strict references. It is as far as I know not documented in earlier perls, but code support for this construct has been in for a long time. It is documented in bleadperl IIRC

The construct is often used in AUTLOAD like this:

sub AUTOLOAD { # get params and function # ... my $func_ref = \&{$func}; goto &{$func_ref}; }
Autark.