in reply to variable function thingy
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
|
|---|