in reply to Using ternary operator as lvalue in push

push is effectively prototyped, so it needs to see that array sigil on its first operand.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: Using ternary operator as lvalue in push
by ikegami (Patriarch) on Jul 31, 2007 at 16:50 UTC
    Is it done this way to allow the prototype to be checked at compile time?
    >perl -c -e"sub t(\@) { @{$_[0]} = '!' } t($c?@a:@b); print @b; Type of arg 1 to main::t must be array (not null operation) at -e line + 1, near "@b)" -e had compilation errors.