On Sep 19, dan said:

>i have a string $limit and i need to check it contains numbers and nothing
>else.
>
>i thought ($limit !~ /\d/) did the job, since i used to be good at this,
>i've slacked the last 6 months or so, and forgotten some of the more obvious
>things. when i find out, i'll probably slap myself and go "ahh that's it!"

You can use

  if ($limit =~ /^\d+$/) {
    # it's only digits (and a possible newline at the end)
  }

or

  if ($limit !~ /\D/) {
    # $limit does NOT have a NON-digit
  }

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to