Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/Variables and Data Types/Helper Functions/Unshift

From NetSec
Revision as of 03:19, 16 July 2012 by AlizaLorenzo (Talk | contribs) (Created page with "* The '''unshift()''' function is like the inverse of the '''push()''' function and treats the array like a stack. In stead of pushing to the top o...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • The unshift() function is like the inverse of the push() function and treats the array like a stack. In stead of pushing to the top of the stack, this function operates against the bottom of the stack.
my @array;
$array[0] = 1;
unshift(@array,0); # $array[0] now contains "0" and $array[1] now contains [1].