while (($key, $value) = each(%hashA)){ print "$key = ".$hashB{$hashA{"${value}"}}."\n"; }