For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2005 > confusing no. of bytes in $1 (z/OS, perl-5.8.6)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2005-06-06, 3:56 pm

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.

________________________________________
_________________________
Millions of marriage proposals.
http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 Find your match on
BharatMatrimony.com

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com