in reply to Using foreach on a hash passed to a subroutine
Gives:use strict; use warnings; sub processInterfaceData (\%\%) { my ($h, $nh) = @_; foreach my $key (keys %{$h}) { print "$key\n"; } } my %myUnitIfs; my %config; processInterfaceData($config{units}{myUnit}{interfaces}, %myUnitIfs);
It gives the error as the calling line, not the subroutine, at compile time. Alos, because the caller does not specify the \ to indicate the reference, it is less likely for the problem to arise.Type of arg 1 to main::processInterfaceData must be hash (not hash ele +ment)
|
|---|