# New Ticket Created by Michael G Schwern # Please include the string: [perl #36612] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36612 >
perlfunc/shift sez: If ARRAY is omitted, shifts the @_ array within the lexical scope of subroutines and formats, and the @ARGV array at file scopes or within the lexical scopes established by the "eval ''", "BEGIN {}", "INIT {}", "CHECK {}", and "END {}" constructs. I think the bit about when @ARGV kicks in is a bit misleading. $ perl -wle '{ print shift }' foo bar foo $ perl -wle 'do { print shift } while @ARGV' foo bar foo bar I think its more correct to say If ARRAY is omitted, shifts the @_ array within the lexical scope of subroutines and formats, and the @ARGV array outside of a subroutine and also within the lexical scopes established by the C<eval STRING>, C<BEGIN {}>, C<INIT {}>, C<CHECK {}> and C<END {}> constructs. Using @ARGV inside eval STRING is surprising. Anyone know why it does that? $ perl -wle 'sub foo { print eval "shift" } foo("this")' foo bar foo -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern Ahh email, my old friend. Do you know that revenge is a dish that is best served cold? And it is very cold on the Internet!
4759,4763c4759,4764 < array, returns the undefined value. If ARRAY is omitted, shifts the < C<@_> array within the lexical scope of subroutines and formats, and the < C<@ARGV> array at file scopes or within the lexical scopes established by < the C<eval ''>, C<BEGIN {}>, C<INIT {}>, C<CHECK {}>, and C<END {}> < constructs. --- > array, returns the undefined value. > > If ARRAY is omitted, shifts the @_ array within the lexical scope of > subroutines and formats, and the @ARGV array outside of a subroutine > and also within the lexical scopes established by the C<eval STRING>, > C<BEGIN {}>, C<INIT {}>, C<CHECK {}> and C<END {}> constructs.