nedals has asked for the wisdom of the Perl Monks concerning the following question:
$var = 1234;
$var = "1234";
Is there a function/test in Perl that can tell the difference between the above number or string?
$var = "1234";
Is there a function/test in Perl that can tell the difference between the above number or string?
I tried this but the answer is always numeric.
use POSIX;
print isdigit($var) ? "numeric\n" : "string\n";
Back to
Seekers of Perl Wisdom