in reply to passing array

You got good replies so far, but note that the way this data structure works, it's easy to slice up the matrix in one direction but hard to do it in the other. If you only ever need to do your slicing one way, follow the examples above to design the order of the dimensions in your array. If your data is numerical and you'll need to slice it either way, you might want to take a look at PDL. If that doesn't help... you may need to pass an explicit index.

BTW, you probably don't need the ($) to my_subroutine. Subroutine templates in Perl are unlinke what you may be used to from other languages.