more useful options | |
PerlMonks |
RE (tilly) 1: Array mysteriously disappears on loop exit...by tilly (Archbishop) |
on Oct 09, 2000 at 22:49 UTC ( [id://35979]=note: print w/replies, xml ) | Need Help?? |
The my declaration is lexical, so when you return from
the function if that code is in another file you could be leaving the scope of that array. Declaring with use vars should solve that. But that said, using global like this is usually an indicator of poorly factored design. Instead design your code so that you return the array instead of manipulate it. That kind of design tends to be more flexible and ages much better.
In Section
Seekers of Perl Wisdom
|
|