http://www.perlmonks.org?node_id=1019362


in reply to Is this reliable?

As far as I know the results of a comparative will always evaluate as a non-zero if true. That said I'd be more comfortable doing things this way:

my $r = (temp> 100? 1000: 1250);
That should eliminate any doubt of the matter.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re^2: Is this reliable?
by AnomalousMonk (Archbishop) on Feb 18, 2013 at 16:59 UTC

    Or even
        $r += ($temp > 100 ? 250 : 0);
    or
        $temp > 100 and $r += 250;