Perl Programming/Keywords/unshift

Previous: unpack Keywords Next: untie

The unshift keyword edit

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 edit

  unshift ARRAY, LIST
  unshift EXPRESSION, LIST

Example edit

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

See also edit

Previous: unpack Keywords Next: untie