in reply to Print both elements in a compare

The hash doesn't hold an entry for 'e' because of the way you created it. And even if it did, it would be a count, not the corresponding element 'd'...

If the array elements match up by index, why not compare them iterating over the arrays?

for my $i (0..$#array1) { if ($array1[$i] eq $array2[$i]) { ... } }