perl-unicode

confusing no. of bytes in $1 (z/OS, perl-5.8.6)

2005-06-06 06:51:59
I run the following script :

$a = 160;
$b = 256;

for ($i=$a;$i<=$b;$i++)
{
  $str = join '', $str, pack 'U*', $i;
}

if ($str =~ /(\p{inlatin1supplement}+)/)
{
  print "\$1 : $1\n";
}

on redirecting above o/p to od -tc -tx, $1 has 2 bytes
for all matching code point values (160-255).

If the above test is repeated with $a = 192, $b = 256,
$1 has 1 byte for all matching code point values
(192-255).

Why is this so ? 

Thanks in advance,
Rajarshi.


                
__________________________________ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 


<Prev in Thread] Current Thread [Next in Thread>
  • confusing no. of bytes in $1 (z/OS, perl-5.8.6), Rajarshi Das <=