Use this: print "@{[5&6]}" +7, "\n"

 
Best Regards,
Dov Levenglick
DSP SoC System and Applications Engineer,
Network and Computing Systems Group
Freescale Semiconductor Israel
Tel. +972-9-952-2804
The information contained in this email is classified as:
[ ] Freescale General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Proprietary
[x] Personal Memorandum

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jason Elbaum
Sent: Wednesday, May 02, 2007 17:06
To: Perl in Israel
Subject: [Israel.pm] Strange "Argument isn't numeric" warning

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
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to