We don't bite newbies here... much | |
PerlMonks |
Re: Checking whether a $var is a numberby John M. Dlugosz (Monsignor) |
on Sep 05, 2001 at 01:26 UTC ( [id://110163]=note: 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 Section
Seekers of Perl Wisdom
|
|