Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use constant DLE=>0x10; my $dle = sprintf ("%02X", DLE); my $msg = pack ("CCCCC", 0x31, 0x32, 0x10, 0x10, 0x33); # match $dle's expanded, replacement is not expanded ? $msg =~ s/\x{$dle}\x{$dle}/\x{$dle}/g; printf ("%02x " x length($msg) . "\n", unpack ("C*", $msg));
[scott@localhost test]$ ./test.pl Illegal hexadecimal digit '$' ignored at ./test.pl line 7. 31 32 00 33 [scott@localhost test]$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is variable interpolation suppressed in \x{$xxx} replacement ?
by Abigail-II (Bishop) on Sep 29, 2003 at 14:33 UTC | |
|
Re: Why is variable interpolation suppressed in \x{$xxx} replacement ?
by broquaint (Abbot) on Sep 29, 2003 at 14:48 UTC | |
|
Re: Why is variable interpolation suppressed in \x{$xxx} replacement ?
by sgifford (Prior) on Sep 29, 2003 at 16:16 UTC | |
by Anonymous Monk on Sep 29, 2003 at 18:24 UTC | |
by bart (Canon) on Sep 29, 2003 at 18:52 UTC |