[Israel.pm] Strange "Argument isn't numeric" warning

Jason Elbaum jason.elbaum at gmail.com
Wed May 2 17:06:21 EEST 2007


Can anyone explain the following phenomenon, or is it a bug in perl?

The code:

use warnings;

print 5 + 7, "\n";
print "5" + 7, "\n";
print "5&6" + 7, "\n";


The output:

Argument "5&6" isn't numeric in addition (+) at - line 5.
12
12
12


So is "5&6" numeric or not? The warning says it isn't, but the
addition evaluates to 12! Shouldn't non-numeric strings evaluate to
zero?


Jason



More information about the Perl mailing list