in reply to Referencing a hash of hashes
This is because you are storing the name of the subroutine in your hash, when you should be storing a reference to the subroutine.
You can then call the sub like this:my %scripts = ( "010" => { sub => \&ACC_GET_STEP, step => '010', }, "020" => { sub => \&ACC_PUT_STEP, step => '020', }, "030" => { sub => \&ACC_GET_STEP, step => '030', }, );
The first way of doing it looks cleaner and and running subs with a & prefix is a bad habit as it has magic when no arguments are passed.$sub = $scripts{$script}{sub} ; $sub->($file, $step); # Or &$sub($file, $step);
In Section
Seekers of Perl Wisdom