in reply to Is this reliable?
It should work reliably (but I couldn't find any links about it, besides Truth and Falsehood, Scalar values). You can force any true value to be 1 by adding !! before it. You can also use $r += $temp > 100 ? 250 : 0; if you are still in doubt.
Update: as pointed out above, it usually works and should work further, but the ternary operator is safer.
Sorry if my advice was wrong.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Is this reliable way to cast from BOOL to NUMBER?
by misterperl (Pilgrim) on Feb 18, 2013 at 16:57 UTC | |
by tobyink (Canon) on Feb 18, 2013 at 17:13 UTC | |
by jethro (Monsignor) on Feb 18, 2013 at 17:18 UTC | |
by AnomalousMonk (Archbishop) on Feb 18, 2013 at 17:12 UTC | |
by aitap (Curate) on Feb 18, 2013 at 17:04 UTC |
In Section
Seekers of Perl Wisdom