Reputation: 577
In Perl 5.26.2 I get:
Experimental each on scalar is now forbidden at a.plx line 67.
Type of arg 1 to each must be hash or array (not private variable) at a.plx
line 67, near "$val)"
Execution of a.plx aborted due to compilation errors.
Where line 67 is the while in
67 while (my ($ip, $val2) = each($val))
68 {
......
}
Upvotes: 1
Views: 1204
Reputation: 386331
each
takes a hash, not a reference.[1] Therefore,
while (my ($ip, $val2) = each($val))
should be
while (my ($ip, $val2) = each(%$val))
Perl 5.12, 5.14 and 5.16 allowed a reference to be used. This was a mistake.
Perl 5.18, 5.20 and 5.22 still allowed it, but warned if you did.
Perl 5.24 reverted this addition.
Upvotes: 5