The syntax works fine for me, $hash is just the hash of code referances $params->{action} is just the key for which one to call. Here is the surrounding code.
my $q =new CGI; my $params=$q->Vars(); my %hash=('sub1'=>\&sub1,'sub2'=>\&sub2, ''= >\¬found); main(); sub main { #call the sub as defined by cgi param 'action' &$hash{$params->{'action'}}->() ; }
Thanks all for the tip on pushing undef, don't know if I asked much of a question was just checking this is 'normal' behaviour Update My mistake somehow added quotes when retyping
In reply to Re: Re: null keys
by hakkr
in thread null keys
by hakkr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |