... but all I'm getting is: Can't use string ("foo") as a subroutine ref while "strict refs" in use ... What should I be doing? It works if I don't use strict, so something like this is possible.my $var = "foo"; &$var(); # now sub foo is called; $var = "bar"; &$var(); # now sub bar is called; sub foo { print "foo answering"; } sub bar { print "bar answering"; }
In reply to calling a sub using a variable's value by rvosa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |