Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
if (/\D/) { print "has nondigits\n" } if (/^\d+$/) { print "is a whole number\n" } if (/^-?\d+$/) { print "is an integer\n" } if (/^[+-]?\d+$/) { print "is a +/- integer\n" } if (/^-?\d+\.?\d*$/) { print "is a real number\n" } if (/^-?(?:\d+(?:\.\d*)?|\.\d+)$/) { print "is a decimal number\n" + } if (/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) { print "a C float\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: variable has numeric value?
by choroba (Cardinal) on Mar 11, 2014 at 14:05 UTC | |
|
Re: variable has numeric value?
by toolic (Bishop) on Mar 11, 2014 at 14:22 UTC | |
|
Re: variable has numeric value?
by hazylife (Monk) on Mar 11, 2014 at 14:22 UTC | |
|
Re: variable has numeric value?
by ww (Archbishop) on Mar 11, 2014 at 14:42 UTC | |
by Anonymous Monk on Mar 11, 2014 at 20:43 UTC |