http://qs321.pair.com?node_id=630123


in reply to Re: Using ternary operator as lvalue in push
in thread Using ternary operator as lvalue in push

It's a hard-wired limitation of Perl 5, but you're not going to have to live with it forever because it's fixed in Perl 6. The way we fixed it was by not committing to scalar/list distinctions until the argument list is actually bound to a function. When we do this, most of the problems of Perl 5's prototypes simply evaporate. In fact, this works fine in pugs:
my @x = my @y = (); push (False,True).pick ?? @x !! @y, <a b c>; say "x: @x[]"; say "y: @y[]";
and randomly pushes the list onto one array or the other.