in reply to shift v. indexing into an array

I've read that monks avoid indexing into an array.

I've never read that myself.

if a monk had an array with 1 million elements would they call shift to get the first element

If you really needed to modify the array then there is no other way, else you should not modify it and just use an index into the array.

Replies are listed 'Best First'.
Re^2: shift v. indexing into an array
by 7stud (Deacon) on Nov 15, 2009 at 15:18 UTC
    You could add new items to the end of an array by simply storing them as elements with new, larger indices. But real Perl programmers don't use indices.*

    *Of course, we're joking. But there's a kernel of truth in this joke.

    Learning Perl 5th, p. 45

    Is the Llama infecting me with fleas? I feel comfortable manipulating the right side of an array with pop and push, but messing around with the left side of an array using shift and unshift sets off alarm bells.