You'll want to check that $function{$action} is defined before using it, of course.# Define a list of 'actions' by listing function names my %function = map { $_ => \&$_ } qw[ post read default ]; # ... my $action = something(); # Wherever you get it $function{$action}->(@somestuff); # Pass any parameters
In reply to Re: Function Dereferencing
by tadman
in thread variable function thingy
by nujersedvl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |