Randy W. Sims wrote:
Jerry Preston wrote:
What needs to be changed in /(-?\d+\.?\d*)/ so that it also see
number like .59?

This is why I like to recommend Regexp::Common. But...

use warnings; use Regexp::Common 'number'; $_ = '.'; /^$RE{num}{real}$/ and print "\"$_\" is a number.\n"; my $x = 1 if $_ < 5;

Outputs:
"." is a number.
"." isn't numeric in numeric lt (<) at ...

Regexp::Common considers an alone decimal point to be a number, while
the Perl compiler does not. Did you know that?  ;-)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
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