good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: How to check if a scalar value is numeric or string?by JavaFan (Canon) |
on Aug 27, 2009 at 14:58 UTC ( [id://791671]=note: print w/replies, xml ) | Need Help?? |
Generally, yes. In a few cases, there's a difference. Binary bit operators, for instance.
And you might think the following code won't give you a divide by zero error: but it will if $num eq '00'. Devel::Peek is a tool that can tell you whether scalar holds a numeric value or not (look for the IV and NV flags).
In Section
Seekers of Perl Wisdom
|
|