perl-unicode

just to test my understanding...

2007-10-17 09:54:19
is this regex:

$has_wide = ($str =~ m/[^\0-\377]/);

the same as this function?

sub has_wide {
  my $str = shift;
  for my $i (0..length($str)-1) {
    return 1 if (ord(substr($str, $i, 1)) >= 256);
  }
  0;
}

but this doesn't seem to work:

$has_wide = ($str =~ m/[\x{100}-]/);

<Prev in Thread] Current Thread [Next in Thread>
  • just to test my understanding..., E R <=