laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Your three-deep loop could be written, Inside the map block is what happens in your deepest loop level. That is a reference to an array of $size[2] zeros. The list map acts on is bogus. Any list of $size[1] items would do there because the data in that list is never touched or remembered. It's only there to make $size[1] different copies of the inner array. A reference is taken to the whole map expression to make the top level data in @array. Setting 3d array elements is easier than you think. Just say, If you don't care about checking index range, all that logic can go. blokhead's lvalue sub for fetch and store is an elegant approach. After Compline, In reply to Re: N-Dimensional Arrays on the fly
by Zaxo
|
|