=over =item shift ARRAY X =item shift Removes and returns the B element of an array. This shortens the array by one and moves everything down. my @arr = ('cat', 'dog'); my $item = shift(@arr); # 'cat' # @arr is now ('dog'); Returns C if the array is empty. B C may also return C if the first element in the array is C. my @arr = (undef, 'two', 'three'); my $item = shift(@arr); # undef If ARRAY is omitted, C operates on the C<@ARGV> array in the main program, and the C<@_> array in subroutines. C will operate on the C<@ARGV> array in C, C, C, C blocks. Starting with Perl 5.14, an experimental feature allowed L|/shift ARRAY> to take a scalar expression. This experiment has been deemed unsuccessful, and was removed as of Perl 5.24. See also L|/unshift ARRAY,LIST>, L|/push ARRAY,LIST>, and L|/pop ARRAY>. L|/shift ARRAY> and L|/unshift ARRAY,LIST> do the same thing to the left end of an array that L|/pop ARRAY> and L|/push ARRAY,LIST> do to the right end. =back