in reply to Re^4: Escaping a variable
in thread Escaping a variable

It's easier when you read the directions we pointed to: hex, chr.

use warnings; use strict; use Test::More; my $bar = "\x04\x4d"; my $foo = "044d"; my $string; while ($foo =~ m/(..)/g) { $string .= chr(hex($1)); } is( $bar, $string, '$bar eq $string' ); done_testing(); print "string: $string\n"; print "bar: $bar\n"; __END__ ok 1 - $bar eq $string 1..1 string: M bar: M

Update: For the record, Test::More, is(), and done_testing() are not significant to the solution. I used them to demonstrate the equality.


Dave