How to remove value from beginning of an array in perl – How to remove value from end of an array in perl

Let’ s say the given array is @array, which is initialized as follows:

Removing value from the beginning of an array
Now, let’s say we want to remove “abc” from the beginning of the array. This can be done using shift function provided by perl. Here is the code snippet to achieve the same:

Output would be:
def ghi jkl

Removing value from the end of an array
To remove a value from the end of array, pop function can be used. Let’s say we want to remove “jkl” from the end of the array. Here is the code snippet in perl to achieve the same:

Output would be:
abc def ghi

Thus by using shift and pop operations, a value can be deleted from array in perl.

  1. Wonderful beat ! I would like to apprentice whilst you amend your web site, how can i subscribe for a weblog website?
    The account helped me a acceptable deal. I have been tiny bit familiar of
    this your broadcast provided brilliant transparent idea

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">