No. The isalpha function I gave returns true only for
[a-zA-Z] characters, false on numbers,
punctation, international letters, or any other character.
It seems to give the same results for me
than lc ne uc:
sub isalpha {
no warnings "numeric";
my($p) = @_;
0==++$p;
}
sub hasalpha {
my($s) = @_;
isalpha(substr($s, 0, 1, "")) and return 1 while
length($s);
return;
};
@t = ("f/2", "-2/", "*+)", "165", "foop", " A=");
$\=$/; $,=" ";
print grep hasalpha($_), @t;
print grep lc ne uc, @t;
outputs
f/2 foop A=
f/2 foop A=
This is because if $p is a non-alnum character in the
isalpha function, $p++ converts it to a numeric 0 first,
than it increases it to 1, so 0==$p++ is false.
|