in reply to What is true and false in Perl?
"0 but true" is (a bit) interesting:
No warnings using numeric addition on a string, despite the 'use warnings'. Also the second case is unexpected. Shouldn't 'True' + 1 be true?use strict; use warnings; print "0 but true" ? "true\n" : "false\n"; print "0 but true" + 0 ? "true\n" : "false\n"; print "0 but true" + 1 ? "true\n" : "false\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What is true and false in Perl?
by ig (Vicar) on Apr 17, 2009 at 02:32 UTC | |
Re^2: What is true and false in Perl?
by morgon (Priest) on Apr 17, 2009 at 01:06 UTC | |
by ikegami (Patriarch) on Sep 15, 2009 at 17:53 UTC | |
by Anonymous Monk on Apr 15, 2012 at 02:16 UTC | |
by AnomalousMonk (Archbishop) on Apr 15, 2012 at 02:42 UTC |
In Section
Tutorials