in reply to Subroutine Reference with use strict
The problem is that you quote the values of the hash. As it is you just put the string \&front_page(@) in $states{Default}.
What you want to do is put a code reference in $states{Default}. You do this, as Ricewind explained, by taking &front_page (the function, as a variable) and taking its reference: \&front_page. Then you can use that code reference, by doing my $current_state= 'Default'; $state{$current_state}->( $param1, $param2) (I suspect you tried to use eval to call the function, you don't need to, and in fact you should not).
|
|---|