in reply to HASH value as a subroutine call
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);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: HASH value as a subroutine call
by AnomalousMonk (Archbishop) on Oct 21, 2012 at 11:46 UTC |
In Section
Seekers of Perl Wisdom