go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
If you use a value as a number, it is a number.
A string that can't be parsed as a number at all will be zero. So, how about something like this:
In a real application, you will have a more precise definition of what you want. For example, a spreadsheet formula might be a literal number or a cell reference. For such things, you can write rules to match what your application needs and is documented to accept. —John Update:fixed typo in substr, reported by dga. Yea, I typed it without checking perlfunc, and I rarely use substr in real code.
In reply to Re: Checking whether a $var is a number
by John M. Dlugosz
|
|