In some programming languages unshift is a function that adds one or more elements to the beginning of an array. For example, in the Perl code below unshift adds “zero” to the beginning of the array to make it “zero one two three”.
my @example = (‘one’, ’two’, ’three’); unshift @example, ‘zero’; print “@example\n”; #Prints: zero one two three
Programming terms
If you want to add to the end of an array, use the push function. If you want to remove the first element of the array, use the shift function.