And now I'm having a mysterious (to me) error with ord in Unicode::String.

==========
#!/usr/bin/perl -w

use Unicode::String qw(utf8);

if(&CheckForProhib("abc")) {print "OK\n"} else {print "Bad\n"};

sub CheckForProhib {
     my $ProhibCheckString = shift(@_);
     my (%ProhibHash, $ThisOrd, @AllInChars, $i, $ThisChar, $ThisHex);

     $ProhibHash{100} = 1;  # Stub value for example

     # Compare the characters in the input against the values in
     #    the ProhibHash.
     for($i=0; $i<(utf8($ProhibCheckString)->length); $i++) {
         push(@AllInChars, utf8($ProhibCheckString)->substr($i, 1));
     }
     print "Sanity check on string: ", join('-', @AllInChars), "\n";
     foreach $ThisChar (@AllInChars) {
         print "Sanity check on char: $ThisChar\n";
         $ThisOrd = utf8($ThisChar)->ord;
         if(exists($ProhibHash{$ThisOrd})) {
             $ThisHex = sprintf("%04lx", $ThisOrd);
             die "Found prohibited character $ThisHex; failing.\n"
         }
     }
}
==========

With Unicode-String-2.06, this produces:

Sanity check on string: a-b-c
Sanity check on char: a
Can't locate object method "ord" via package "a" at ./z line 23.

Am I calling "ord" incorrectly? That doesn't seem likely, given that 
length and substr worked just fine. Any help would be appreciated.

--Paul Hoffman

Reply via email to