in reply to output using map

The loop

while (<$a_fh>) { print unless exists $second_file{unpack 'A*', $_}; }

eats up the whole file. Maybe your intention was like:

while (<$file_a>) { unless (exists $h{unpack 'A*', $_}) { print; } else { last; } }

And then there is of course the other issue with using <$file_x> in list context as already described by Fletch and the questionable use of unpack.

-jo