I have an array, say @array1 = qw(abc def ghi jkl).
Now, I want to use this array in a way that elements are shifted 1 by 1, but that shifting takes place virtually, and not in the array.
Like, "shift" will shift the elements and remove them from the array. But, I don't want those elements to be removed.
Short Code Snippet:
while (my $rName = shift @array1) {
my $bName = shift @array1 ;
## Do something now with the value
}
##And now, I want that I can use @array1 again with the original elements residing
How can it be implemented?