in reply to Printing multiple unknown hashes..

I'd use nested hashes. The first layer is a hash with all of your MAC addresses as the keys, and the values are your second hash which map the keys 'ip' and 'host' to the ip address and hostname, respectively.

foreach my $mac ( keys %CODES ) { printf " %s: Host = %s, IP = %s\n", $mac, $CODES{$mac}->{'host'}, $CODES{$mac}->{'ip'}; }