[Israel.pm] Unicode problem

Offer Kaye offer.kaye at gmail.com
Sun Jun 28 04:08:27 PDT 2009


On Sun, Jun 28, 2009 at 12:38 PM, Peter Gordon wrote:
> Perl Version: 5.010000
> And adding 'use utf8' doesn't make any difference.
>
> Peter
>
>

Gaal is right (ofc :)).
The problem was with the \040, the string in $y automatically escaped
the \ in the string, so you got a " " in $p but the string "\\040" in
$x - i.e. the backslash is escaped (as seen by using Data::Dumper),
causing the 040 to lose its special meaning.

One solution/workaround would be to use the following after your "my ($p)" line:
$p =~ s/\\040/\040/;

So first of all remove the literal backslashes that are followed by
the string 040, then replace with the character \040, which is the
space character.

Regards,
-- 
Offer Kaye


More information about the Perl mailing list