On Nov 13, 2007 12:55 PM, <[EMAIL PROTECTED]> wrote:
> Folks,
>
> I am having a problem dereferencing a hash and am hoping somebody can
> assist. I am getting the error:
>
> Can't use string ("napMD_ProgressCode") as a HASH ref
> while "strict refs" in use
snip
> my %napMD_ProgressCode = (
snip
> drawInputRowControlled('napMD_ProgressCode');
snip
That is because you are passing a scalar containing the string
"napMD_ProgressCode" instead of a reference to the hash. Try
drawInputRowControlled(\$napMD_ProgressCode)
Also, it is wasteful to copy the entire hash into a new variable
(unless you want to make changes that should not be reflected in the
original hash). Just use the arrow operator:
sub drawInputRowControlled{
my $ControlList = shift;
for my $key (sort keys %$ControlList) {
print qq(
<input type="checkbox"
name='status'
value="$ControlList->{$key}{Code}">$ControlList->{$key}{Name}</option><br>
);
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/