in reply to Help reg printing non printable hex characters
If you put \xd1 on the command line, your program will see that literally. In order to match it literally, you have to say
use constant HEXD1 => "\\xd1";Or something like that. You're right that the code is a little strange. I think you'll find it much simpler to say:
# from the command line perl d1 perl d3 # in the code my $arg = hex(shift @ARGV);
update: almut is absolutely correct, that should read
my $arg = chr(hex(shift @ARGV));
or even
my $arg = chr hex shift;
... but I didn't want to obsfuscate the code unnecessarily (shift of what?)
• another intruder with the mooring in the heart of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help reg printing non printable hex characters
by almut (Canon) on Jun 18, 2008 at 08:27 UTC | |
by user1357 (Initiate) on Jun 18, 2008 at 14:02 UTC |