--- name: unshift status: documented runtime: pp source: src/runtime/pp/aggregate.rs --- ```{index} single: unshift; Perl built-in (pp runtime) ``` # unshift ## Synopsis ```perl unshift @array, $value; unshift @array, $v1, $v2, $v3; unshift @array, @more_values; my $new_len = unshift @array, $value; ``` ## Description Prepends one or more values to the beginning of an array. Prepends the listed values to the front of the array, preserving argument order: `unshift(@a, 1, 2, 3)` yields `(1, 2, 3, @original)`. Array arguments are flattened. Returns the new number of elements. Internally, values are inserted in reverse order to achieve the correct final ordering. ## See also shift, push, pop, splice