Draxter has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to escape a variable with the \x special character, so it will be printed as a hex character. I only manage to do this when I statically define variable, for example:
my $foo = "\x4D"; print "$bla"; M
But when i try to add the \x to an already existing variable, I always get an "Illegal hexadecimal digit '$' ignored" error message:
my $foo = "4D"; my $bar = "\x4D"; print $bar . "\n"; Illegal hexadecimal digit '$' ignored at roman.pl line 10. 4D.
What am I doing wrong here, and is it solvable?
Thanks,
Eran
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Escaping a variable
by davido (Cardinal) on Nov 08, 2011 at 09:16 UTC | |
by Draxter (Initiate) on Nov 08, 2011 at 09:19 UTC | |
by davido (Cardinal) on Nov 08, 2011 at 09:23 UTC | |
by Draxter (Initiate) on Nov 08, 2011 at 09:35 UTC | |
by davido (Cardinal) on Nov 08, 2011 at 09:40 UTC | |
by moritz (Cardinal) on Nov 08, 2011 at 09:24 UTC | |
by Draxter (Initiate) on Nov 08, 2011 at 09:26 UTC | |
by davido (Cardinal) on Nov 08, 2011 at 09:27 UTC |