Perl array pop, push, shift, unshift

This is a notice about the array manipulation in Perl, but you should try to avoid to manipulate if you just could iterate troth the array, this is much faster, for this look at Perl shift iterate Benchmark.



remove and return the last element of the array.


add an element to the end of the array.


remove and return the first element of the array.


add an element to the start of the array.


Code example:


Prints this:

4 thoughts on “Perl array pop, push, shift, unshift”

  1. Post writing is also a excitement, if you be familiar with afterward you can write otherwise it is complicated to write.

  2. Hello Dear, are you genuinely visiting this site on a regular basis, if so afterward you will definitely obtain good

Leave a Reply

Your email address will not be published.

fourteen + ten =