in reply to Printing Hexadecimal Characters

No, that prints "2L\n"

In string literals, the C syntax works in Perl:

print PRN "\x02"; # or "\x{02} if the next character is a hex digit. print PRN "L\n";

or just

print PRN "\x02L\n";

If you start with a variable containing the number 2, you can use chr:

print PRN chr(0x02); print PRN "L\n";

or pack:

print PRN pack('C', 0x02); print PRN "L\n";