[JaxPM] counting a string
Nate
nate at netimages.com
Fri Feb 25 15:02:15 CST 2000
On the jacksonville-pm-list; Jax.PM'er Nate <nate at netimages.com> wrote -
I knew that < and > are for numbers, but Larry and Randal make a big deal
in all the docs about how perl will treat a string like a number if you
use it as a number.
I guess I read it wrong.
-----------------------------------------------------------
| Nate Campi | Net Images Support |
| nate at netimages.com | Internet Presence: www.netimages.com |
| nate at campin.net | Infosec docs: www.campin.net |
-----------------------------------------------------------
On Fri, 25 Feb 2000, Bill Jones wrote:
> Date: Fri, 25 Feb 2000 14:24:10 -0500
> From: Bill Jones <bill at fccj.org>
> To: Nate <nate at netimages.com>
> Cc: Jax Perl Mongers <jacksonville-pm-list at happyfunball.pm.org>
> Subject: Re: [JaxPM] counting a string
>
> 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