use strict; use warnings; use constant DLE => 0x10; my $dle = sprintf ("%02X", DLE); print "before\n"; print "string is: [\x{$dle}]\n"; __output__ Illegal hexadecimal digit '$' ignored at pmsopw_294950.pl line 9. before string is: []