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


in reply to Re: Conditional Operator Confusion
in thread Conditional Operator Confusion

Well, pfft - that's no good for golf... although I'm still confused - how does precedence work in this context?

Tom Melly, pm@tomandlu.co.uk

Replies are listed 'Best First'.
Re^3: Conditional Operator Confusion
by Anonymous Monk on Nov 29, 2006 at 12:56 UTC
    ??
    C:\>perl -MO=Deparse,-p for(1..10){ $_>5 ? $x='foo' : $x='bar'; print "$_:$x\n"; } ^Z foreach $_ (1 .. 10) { ((($_ > 5) ? ($x = 'foo') : $x) = 'bar'); print("${_}:$x\n"); } - syntax OK