I don't know if you want it to work with octal or hex but this will work for decimal.
$word =~ /^-?(\d*)\.?(\d*)$/ && (length($1) || length($2));
What's with the length checks? ".807" and "30." are valid numbers whereas "." is not. Hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
In reply to Re: numeric comparison
by antirice
in thread numeric comparison
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |