|Syntactic Confectionery Delight|
Welcome to SoPW! As you may know, several of the Wiser Monks have gathered a massive amount of information in the Tutorials section of the Monastery.
jdporter has an extremely interesting article entitled Arrays: A Tutorial/Reference and there is one about Multidem arrays by someone else in there. As well as articles by thezip, tye and others on many subjects.
I've spent many an hour in the tomes there, the answer may not directly appear, but you might see something that may lead you to the answer.
Oh, yes, BTW, I didn't see "use warnings" & "use strict" in your code example, all seasoned Monks use these to help with debugging Perl scripts. "use diagnostics" may help in your array trials also!
Good luck and welcome to Perl programming, where's there's always more than one way to do it!
"No trees were harmed in the creation of this node. However, a rather large number of electrons were somewhat inconvenienced."