in reply to Sending and reading hex commands on a Win32 serial port

hipowls beat me to it.

#!/usr/bin/perl -w open FH, '>foobar'; print FH pack 'H2H2H2H2', 'ab','cd','ef','00'; print FH pack 'H8','abcdef00'; print FH pack 'H2'x 4, 'ab', 'cd', 'ef', '00'; print `hd "foobar"`,"\n";
Yeilds:
00000000 ab cd ef 00 ab cd ef 00 ab cd ef 00 + 0000000C


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}