in reply to Re: for vs. reverse
in thread for vs. reverse

but I can't figure out why this doesn't work. Doesn't shift work on @_ by default?

Yes and no: see shift. This is an example of Do What I Mean (DWIM). Inside a subroutine or format, shift works on @_ by default. Outside a subroutine, however, shift works on @ARGV by default.

#!perl -l @ARGV = '@ARGV'; @_ = '@_'; print '$ARGV[0] = ', shift; mysub(@_); sub mysub { print '$_[0] = ', shift; }