You need to populate the hash with code-references (\&sub).
Try:
use strict; # my $code_ref = {'SUM', 'sum'}; my $code_ref = {'SUM', \&sum}; sub sum($$){...} # do you really need ($$) ? That is rarely useful. # ($codes->{'SUM'})->(4,5); # $codes? You mean $code_ref? $code_ref->{'SUM'}->(4,5);
In reply to Re: HASH value as a subroutine call
by Perlbotics
in thread HASH value as a subroutine call
by enigma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |