in reply to sub returning undef

Your code depends completely on how mysub2 is called. If you pass an argument, then mysub2 will show the array being defined. Remember that $foo->mysub2 does pass an argument.

----
send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.