You can do it this way
push @{ $_ & 1 ? \@a : \@b }, $_ for 1 .. 10; print "@a\n@b"; 1 3 5 7 9 2 4 6 8 10
And the reason
print prototype( 'CORE::push' ); \@@
In reply to Re: Trinary operator can't be used as first argument of push
by BrowserUk
in thread Ternary operator can't be used as first argument of push
by davido
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |