Surely parameterless shift and pop, operate on @ARGV in the main, or @_ in a sub, as described. But unshift and push, unseasoned with parameters, are a syntax error.
/usr/bin/perl -le '@ARGV=qw(this that more less);pop;shift;print join +"<>", @ARGV;' that<>more /usr/bin/perl -le '@ARGV=qw(this that more less);pop;shift;push;print +join "<>", @ARGV;' Not enough arguments for push at -e line 1, near "push;" /usr/bin/perl -le '@ARGV=qw(this that more less);pop;shift;unshift;pri +nt join "<>", @ARGV;' Not enough arguments for unshift at -e line 1, near "unshift;" /usr/bin/perl -le '@ARGV=qw(this that more less);pop;shift;push "X";pr +int join "<>", @ARGV;' Type of arg 1 to push must be array (not constant item) at -e line 1, +near ""X";" /usr/bin/perl -le '@ARGV=qw(this that more less);pop;shift;unshift "X +";print join "<>", @ARGV;' Type of arg 1 to unshift must be array (not constant item) at -e line +1, near ""X";"
Or is there a cunning way to make them dance?
Cheers,
R.
In reply to Re^2: My very confusing questions
by Random_Walk
in thread My very confusing questions
by ROP
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |