in reply to Re: Calling func named in string
in thread Calling func named in string
Ooh, aah! Thank you for pointing this out!
By changing to use the backslash-ampersand, I do get references. I would have sworn I'd tried this, but that it didn't work, I guess not. Anyways, here's what I've got now...
use strict; + use warnings; my @FuncList = qw(TestSub1 TestSub2); my @CallFunc = map { \&$_ } @FuncList; my %JumpTbl = map { $_ => \&$_ } @FuncList; $CallFunc[1](); $JumpTbl{'TestSub1'}(); exit; sub TestSub1 { print "TestSub1\n"; } sub TestSub2 { print "TestSub2\n"; }
Output:
TestSub2 TestSub1
|
|---|