[JaxPM] counting a string
Bill Jones
bill at fccj.org
Fri Feb 25 13:24:10 CST 2000
On the jacksonville-pm-list; Jax.PM'er Bill Jones <bill at fccj.org> wrote -
on 2/25/00 2:18 PM, Nate at nate at netimages.com wrote:
> On the jacksonville-pm-list; Jax.PM'er Nate <nate at netimages.com> wrote -
>
> The other day I wanted to count a string to make sure that it wasn't too
> long (it was to check the length of a username/password pair for an
> account generation script).
>
> I figured I could do something like this:
>
> print "Password too long, try again\n" if $pass > 14;
>
> ...but it didn't work.
> I ended up having to do this:
>
> while($pass =~ /./g) {
> $count++;
> }
> if($count > 14) {
> print "Password too long, try again";
> } elsif ($count < 4) {
> print "Password too short, try again";
> }
>
if (length($pass) ge 15) {
}
PS - > < and = are for numbers ;)
- FCCJ * 501 W State St * Jacksonville, Fl 32202 * 904/632-3089 -
Jax.PM Moderator's Note:
This message was posted to the Jacksonville Perl Monger's Group listserv.
The group manager can be reached at -- owner-jacksonville-pm-list at pm.org
to whom send all praises, complaints, or comments...
More information about the Jacksonville-pm
mailing list