in reply to Pass an array reference or array indices to a subroutine?

Your second method creates two variables in the block of the body, your first method creates one. Creating a variable, even when there is some reuse, is more expensive than doing an array dereference. Furthermore, you're passing references to indices - so your method to avoid array dereferencing does two scalar dereferences.

But I'm curious about your statement Array dereferencing can be quite expensive. What makes you think that? Dereferencing is just following a pointer. Just doing print $foo means you have to follow a couple of pointers just to get the string value. In the grand scheme of things, array dereferencing is just peanuts.