Programming Perl

Programming PerlSearch this book
Previous: 3.2.142 setsockoptChapter 3
Functions
Next: 3.2.144 shmctl
 

3.2.143 shift

shift ARRAY
shift

This function shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. (Or up, or left, depending on how you visualize the array list.) If there are no elements in the array, the function returns the undefined value. If ARRAY is omitted, the function shifts @ARGV (in the main program), or @_ (in subroutines). See also unshift, push, pop, and splice. The shift and unshift functions do the same thing to the left end of an array that pop and push do to the right end.


Previous: 3.2.142 setsockoptProgramming PerlNext: 3.2.144 shmctl
3.2.142 setsockoptBook Index3.2.144 shmctl