in reply to Using foreach on a hash passed to a subroutine

If you are offended by subroutine prototypes then look-away now.

This is an occasion where a prototype would have helped (OK, so there aren't that many of them):
Update: Doh! No it wouldn't, sorry.
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);
Gives:
Type of arg 1 to main::processInterfaceData must be hash (not hash ele +ment)
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.