in reply to Re: Invoke sub whose name is value of scalar
in thread Invoke sub whose name is value of scalar
Better late than never :)
If (as I guess from the OP's update) the subs do more than one-line of work, you can still use a dispatch table, but arranged like:
sub foo { ... } sub bar { ... } my %hash = ( foo => \&foo, bar => \&bar, ); $var = "foo"; &{$hash{$var}}(@args);
|
|---|