user1357 has asked for the wisdom of the Perl Monks concerning the following question:
when i ran perl hex.pl \xd1 i got the below o/p field1 \xd1 field2 if i hardcode the value in my code likeuse strict; my $seperatorArg; $seperatorArg = shift(@ARGV); print "field1 $seperatorArg field2";
i am getting the desired. can anybody explain my below understanding is correct? what i am thinking is when i hard code, the value i gave in double quotes and hence the variable interpoplation is occuring which results in hex character$seperatorArg = "\xd1";
i am running the program as belowuse constant HEXD1 => "\xd1"; use constant HEXDC => "\xdc"; $arg = shift(@ARGV); if ($arg eq "HEXD1") { $arg = HEXD1; print " HEX D1 IS $arg \n"; } elsif ($arg eq "HEXDC") { $arg = HEXDC; print " HEX DC IS $arg \n"; }
i know this is a bad way of coding.... :( trying in different ways.. but couldnt get the expected o/p. Kindly provide me the pointers on this.perl hex.pl HEXD1 perl hex.pl HEXDC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help reg printing non printable hex characters
by grinder (Bishop) on Jun 18, 2008 at 08:20 UTC | |
by almut (Canon) on Jun 18, 2008 at 08:27 UTC | |
by user1357 (Initiate) on Jun 18, 2008 at 14:02 UTC |