in reply to Calling a function reference with arguments
I strongly advise you use strictures (use strict; use warnings;) which would have told you about the syntax error in my $func_ref = %hash{"my_function"};. Using & to call a sub is somewhat out of favor. The following may get you sorted out:
use strict; use warnings; my %hash = (hello => "Hello World\n", my_function => \&my_func); my $funcref = $hash{my_function}; &$funcref (\%hash); $funcref->(\%hash); sub my_func { my $hashref = shift; print $hashref->{hello} }
Prints:
Hello World Hello World
|
|---|