<?xml version="1.0" encoding="windows-1252"?>
<node id="292" title="perlfunc:shift" created="1999-08-24 18:42:58" updated="2005-08-15 00:06:19">
<type id="119">
perlfunc</type>
<author id="114">
gods</author>
<data>
<field name="doctext">
</field>
<field name="name">

&lt;P&gt;
shift - remove the first element of an array, and return it

&lt;P&gt;
&lt;HR&gt;
</field>
<field name="synopsis">

&lt;P&gt;
shift 
&lt;FONT SIZE=-1&gt;ARRAY&lt;/FONT&gt;

&lt;P&gt;
shift

&lt;P&gt;
&lt;HR&gt;
</field>
<field name="description">

&lt;P&gt;
Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. If there are no elements in the array, returns the undefined value. If 
&lt;FONT SIZE=-1&gt;ARRAY&lt;/FONT&gt; is omitted, shifts the

&lt;CODE&gt;@_&lt;/CODE&gt; array within the lexical scope of subroutines and formats, and the
&lt;CODE&gt;@ARGV&lt;/CODE&gt; array at file scopes or within the lexical scopes established by the [perlfunc:eval|eval ''], &lt;CODE&gt;BEGIN {}&lt;/CODE&gt;, &lt;CODE&gt;END {}&lt;/CODE&gt;, and &lt;CODE&gt;INIT {}&lt;/CODE&gt; constructs. See also [perlfunc:unshift|unshift()], [perlfunc:push|push()], and [perlfunc:pop|pop()].  &lt;CODE&gt;Shift()&lt;/CODE&gt; and [perlfunc:unshift|unshift()] do the same thing to the left end of an array that [perlfunc:pop|pop()] and [perlfunc:push|push()] do to the right end.

&lt;HR&gt;
</field>
</data>
</node>
