Back in the good ol' days, push and its ilk could take as their first argument an EXPR that evaluated to an unblessed array reference, making the syntax slightly less convoluted:
Today, we have Postfix Dereference Syntax (see perlref). Ah, the good ol' days... (sigh)c:\@Work\Perl>perl -wMstrict -MData::Dump -le "print qq{perl version $]}; ;; my (@foo, @bar); my $fooish = 1; push $fooish ? \@foo : \@bar, 'quux'; dd \@foo; dd \@bar; " perl version 5.014004 ["quux"] []
Update: To avoid leading anyone astray, I should have mentioned that, per the docs: "Starting with Perl 5.14, an experimental feature allowed push to take a scalar expression. This experiment has been deemed unsuccessful, and was removed as of Perl 5.24." (This behavior was also removed from related built-ins pop, keys, values, and other such functions that, for a time, operated by reference on arrays and hashes.) (Update: For the official announcement, see The autoderef feature has been removed in perl5240delta.)
Give a man a fish: <%-{-{-{-<
In reply to Re^7: Ignore a range of numbers ina List
by AnomalousMonk
in thread Ignore a range of numbers ina List
by pr33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |