Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
A simple way to test for numeric values. It basically asks perl whether it thinks the argument is numeric, by testing whether the argument is "numerically equal" to itself, and trapping any errors. Update: Dang! I guess one could add !ref($x) && to the last line, but the joy is gone... Update 2: Thanks Fletch; Scalar::Util::looks_like_number is the way to go.
In reply to is_numeric by tlm
|
|