in reply to Re: Re: Re: if-else vs. tertiary effieciency?
in thread if-else vs. tertiary effieciency?

so the print isnt part of the ?: in fruiture's example...if thats the case then it makes beautiful sense and i cant believe i didnt see it before, if thats not the case im a little more lost than i was to begin with :)

ill be sure to ++ you when i get my next set of votes ;)
  • Comment on REł: if-else vs. tertiary effieciency?

Replies are listed 'Best First'.
Re^4: if-else vs. tertiary effieciency?
by Aristotle (Chancellor) on Sep 15, 2002 at 07:43 UTC
    If in doubt, deparse:
    $ perl -MO=Deparse,-p -e'print $var ? "yes" : "no";' print(($var ? 'yes' : 'no')); -e syntax OK
    The ternary operator here has a higher precedence than the print that works as a list operator, so Perl does the right thing.

    Makeshifts last the longest.