Re: [PBML] Test for Number or String
- "Mike Dillinger" <miked@...> queried:
: Is there an easier way to test for numeric stuff?
: I know C has isnum or isdigit or something like that,
: and it would be cool if PERL had a function like that
: rather than doing a regexp test. I'm also open to
: suggestions on how to test for numeric responses
: that you might have.
my $test = 7000_000_003;
print isdigit( $test ) ? "numeric\n" : "string\n";
Charles K. Clarkson
Head Bottle Washer,
Clarkson Energy Homes, Inc.
CJ Web Work - Domains for Real Estate Investors.
E Pluribus Unum -- One from many.
- On May 2, Mike Dillinger said:
>Is there an easier way to test for numeric stuff? I know C has isnum orC does it differently because C is not Perl.
>isdigit or something like that, and it would be cool if PERL had a
>function like that rather than doing a regexp test. I'm also open to
>suggestions on how to test for numeric responses that you might have.
Try 'perldoc -q integer' and see what the FAQ tells you. You're not too
Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<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. ]