in reply to work with Array of Arrays

Consider using Math::Matrix, especially if you're going to be doing more than just scanning the contents.