in reply to Re: Calling func named in string
in thread Calling func named in string
Strictly speaking, if you get the syntax right there is no need for no strict 'refs';. See choroba's reply above and your updated test code below.
use strict; use warnings; my %JumpTbl = (TestSub1 => \&TestSub1, TestSub2 => \&TestSub2); my @FuncList = values %JumpTbl; $JumpTbl{'TestSub2'}(); $FuncList[0](); sub TestSub1 { print "TestSub1\n"; } sub TestSub2 { print "TestSub2\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Calling func named in string
by MikeL (Acolyte) on Dec 16, 2024 at 19:29 UTC | |
by GrandFather (Saint) on Dec 16, 2024 at 22:32 UTC |