use strict; use warnings; my $integer = 777; my $string = 'hello'; my $float = 3.22 + 4.34; print _isNumeric($integer) . "\n"; print _isNumeric($string) . "\n"; print _isNumeric($float) . "\n"; sub _isNumeric { my ($value) = @_; no warnings; return 1 if ($value + 0) eq $value; return 0; }
In reply to Re: How to check if a scalar value is numeric or string?
by bluestar
in thread How to check if a scalar value is numeric or string?
by bgupta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |