in reply to isAlpha / isNumeric
If what you want to do is distinguish between letters and numbers, you might try:
#!/usr/bin/perl -w my $a = "aBcdeFG"; if ($a =~ /[A-Za-z]/) { # No i modifier needed print "Alphabet\n"; } elsif ($a =~ /\d/) { # \d matches 0-9 only print "Numeric\n"; } else { print "Non-numeric, non-alphabet\n"; }
Gary Blackburn
Trained Killer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: isAlpha / isNumeric
by Jamnet (Scribe) on Mar 23, 2001 at 10:55 UTC | |
|
Re: Re: isAlpha / isNumeric
by Jamnet (Scribe) on Mar 23, 2001 at 10:59 UTC |