Для создания бинарного файла используется
open (my $fh, '>:raw', $qfn)
Чтобы поместить
45 7f 46 4c 01 02 00 01
в этот файл, можно использовать любой из следующих параметров:
# Starting with a string of those bytes.
print $fh "\x45\x7f\x46\x4c\x01\x02\x00\x01";
# Starting with a hex representation of the file.
print $fh pack('H*', '457f464c01020001');
# Starting with the bytes.
print $fh map chr, 0x45, 0x7f, 0x46, 0x4c, 0x01, 0x02, 0x00, 0x01;
# Starting with the bytes.
print $fh pack('C*', 0x45, 0x7f, 0x46, 0x4c, 0x01, 0x02, 0x00, 0x01);