I have a Unicode string in a program, and a unicode string on in a file,
and the strings do not match as equal.
In the example below, save the program as file /tmp/a2.pl.
Run the program /tmp/a2.pl. The program reads itself and extracts the
unicode string.
The strings do not match.
When displayed, the strings are not the same.
What do I need to do to get them to display and match as equal?
Thanks,
Peter
#! /usr/bin/perl
use strict ;
use warnings ;
my $x = "//10.39.43.1/사과를\040좋아해요" ;
open(my $fh, "<:utf8", "/tmp/a2.pl");
local $/ = undef ;
my $y = <$fh> ;
close $fh ;
my ($p) = $y =~ m!"(//.*?)"! ;
print $p,"\n";
print $x,"\n";
if ($p eq $x) {
print "EQUAL\n" ;
} else {
print "NOT EQUAL\n" ;
}
DB<1> p $p
//10.39.43.1/사과를\040좋아해요
DB<2> p $x
//10.39.43.1/사과를 좋아해요
DB<3>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl