"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
In your writeup you mention @aod, and in the script show us @aob. @aob is never declared within the sub popnum3. A first step toward keeping things from breaking easily is to make sure that all the variables used in a sub are passed to it explicitly, rather than absorbing from outer scopes. Perhaps you could pass @aob from an outer scope like this:
or
As soon as subs start absorbing values rather than having values passed to them, they become fragile, and it makes it all the harder to track down the effects of small changes elsewhere in the code. Keeping scopes narrow and passing values reduces 'errors at a distance.' This isn't actually the specific error you're describing, but it as advice that will make your code easier to deal with. Dave In reply to Re: undefined value in array reference
by davido
|
|