On Thu, 17 Jul 2003 21:14:58 -0400
terry(_at_)eatoni(_dot_)com (terry jones) wrote:
I know no-one in their right mind would want to do this, but...
The code below produces an unexpected (for me) result. The first call
to read_script() reports 23 codepoint ranges. The second reports 0.
Regards,
Terry.
If you use "foreach" instead of "while shift",
that should work finely.
Operation "shift" breaks internal caches.
#!/usr/bin/perl -w
use Unicode::UCD 'charscript';
sub read_script {
my $script = shift;
my $ranges = charscript($script);
printf "Read script $script. %d ranges exist.\n", scalar(@$ranges);
foreach my $range (@$ranges) {
printf "%06X -> %06X\n", $$range[0], $$range[1];
}
}
read_script('Latin');
read_script('Latin');
SADAHIRO Tomoyuki