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