Reputation: 53
I'm getting this error when attempting to run this script - on this line
Type of arg 1 to each must be hash (not hash element)
while (my ($action, $value) = each($cameras{$camera}{$mode})) {
How do I fix this error?
Upvotes: 2
Views: 2781
Reputation: 67900
Assuming that $cameras{$camera}{$mode}
is a reference to a hash:
each ( %{ $cameras{$camera}{$mode} } );
As the error says, type of arg 1 to each must be a hash (not a hash ref).
If it is not a hash ref, then you cannot use each
on it.
Upvotes: 2
Reputation: 62037
Dereference the hash:
while (my ($action, $value) = each(%{ $cameras{$camera}{$mode} })) {
Upvotes: 5