in reply to Re^4: Question about returning array from sub
in thread Question about returning array from sub

It's gonna throw that warning whenever $_[2][0] is undefined, i.e. didn't get a true value when the array in $_ was created.

Your code is getting hard to read with all the long variables and math functions, which don't have to do with you understanding the issue (so you'll know how to do it next time). Please reduce to a minimal test case using minimal values and structures to stand in for your, until you have the functionality as you want it. Then plug your data/logic back in.

Remember: Ne dederis in spiritu molere illegitimi!