Perl Programming/Keywords/unshift

Previous: unpack Keywords Next: untie

The unshift keyword

unshift does the opposite of shift. It prepends list to the front of the array and returns the new number of elements in the array.

Syntax

  unshift ARRAY, LIST
  unshift EXPRESSION, LIST

Example

unshift(@ARGV, '-e') unless $ARGV[0] =~ /^-/;

See also

Previous: unpack Keywords Next: untie
Category:Book:Perl Programming#Keywords/unshift%20
Category:Book:Perl Programming