Perl Programming/Keywords/unshift

Previous: unpack Keywords Next: untie

The unshift keywordEdit

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.

SyntaxEdit

  unshift ARRAY, LIST
  unshift EXPRESSION, LIST

ExampleEdit

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

See alsoEdit

Previous: unpack Keywords Next: untie