JupiterHost.Net wrote:


Randy W. Sims wrote:

N, Guruguhan (GEAE, Foreign National, EACOE) wrote:

Hi All,
I wanted to check whether the user input is only a number and does contain any alphabet/s anywhere i.e. starting, end or in-between. Can somebody tell me how to do this?


How about simply m/^\d+$/

Yeah, that works. I guess I like recommending Regexp::Common because it's standard and becuase it's more flexible and robust:


use Regexp::Common qw(number);

/^$RE{num}{int}{-sep=>',?'}$/
  and print "An integer with optional comma seperator."

Use the Regexp::Common module:

<http://search.cpan.org/dist/Regexp-Common/>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to