Re: return array/hash ref from function

2004-05-12 Thread Andrew Gaffney
Andrew Gaffney wrote: Wiggins d Anconia wrote: Wiggins d Anconia wrote: my %masks; my %use; my @pkglist; my %pkgdeps; Why are these declared with a global scope? If they must be then something is wrong with your subs. Move these to after your sub listing, if your program still works then th

Re: return array/hash ref from function

2004-05-12 Thread Andrew Gaffney
Wiggins d Anconia wrote: Wiggins d Anconia wrote: my %masks; my %use; my @pkglist; my %pkgdeps; Why are these declared with a global scope? If they must be then something is wrong with your subs. Move these to after your sub listing, if your program still works then they are fine as globals, ot

Re: return array/hash ref from function

2004-05-12 Thread Wiggins d Anconia
> Wiggins d Anconia wrote: > >> > >>my %masks; > >>my %use; > >>my @pkglist; > >>my %pkgdeps; > > > > Why are these declared with a global scope? If they must be then > > something is wrong with your subs. Move these to after your sub > > listing, if your program still works then they are fine

Re: return array/hash ref from function

2004-05-12 Thread Andrew Gaffney
Wiggins d Anconia wrote: Charles K. Clarkson wrote: Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : I think that 'my' is bad because I have something similar to: : : my %tree; : : sub return_an_arrayref() { :my @array = ('thing1', 'thing2', 'thing3'); :return [EMAIL PROTECTED]; : } : : s

Re: return array/hash ref from function

2004-05-12 Thread Wiggins d Anconia
[snip] > > It was more pseudocode than anything. I can't seem to duplicate the problem with > test code. One thing I forgot to mention is that these functions are called > recursively as far as 15 levels deep. Would that cause issues when returning a > ref to a 'my'ed array from a function? >

Re: return array/hash ref from function

2004-05-12 Thread Wiggins d Anconia
> Charles K. Clarkson wrote: > > Andrew Gaffney <[EMAIL PROTECTED]> wrote: > > : > > : I think that 'my' is bad because I have something similar to: > > : > > : my %tree; > > : > > : sub return_an_arrayref() { > > :my @array = ('thing1', 'thing2', 'thing3'); > > :return [EMAIL PROTECTED]

Re: return array/hash ref from function

2004-05-12 Thread Andrew Gaffney
Wiggins d Anconia wrote: Wiggins d Anconia wrote: I have a number of functions in a program I'm writing that return a reference to an array or hash. In the functions, I declare the variable to return with 'my' which I'm finding out is bad. Should I declare variables to return from a functi

Re: return array/hash ref from function

2004-05-12 Thread Andrew Gaffney
Charles K. Clarkson wrote: Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : I think that 'my' is bad because I have something similar to: : : my %tree; : : sub return_an_arrayref() { :my @array = ('thing1', 'thing2', 'thing3'); :return [EMAIL PROTECTED]; : } : : sub build_tree() { :for

RE: return array/hash ref from function

2004-05-12 Thread Charles K. Clarkson
Andrew Gaffney <[EMAIL PROTECTED]> wrote: : : I think that 'my' is bad because I have something similar to: : : my %tree; : : sub return_an_arrayref() { :my @array = ('thing1', 'thing2', 'thing3'); :return [EMAIL PROTECTED]; : } : : sub build_tree() { :foreach(@thing) { : $tree

Re: return array/hash ref from function

2004-05-12 Thread Wiggins d Anconia
> Wiggins d Anconia wrote: > >>I have a number of functions in a program I'm writing that return a > > > > reference to > > > >>an array or hash. In the functions, I declare the variable to return > > > > with 'my' > > > >>which I'm finding out is bad. Should I declare variables to return fro

Re: return array/hash ref from function

2004-05-12 Thread Andrew Gaffney
Wiggins d Anconia wrote: I have a number of functions in a program I'm writing that return a reference to an array or hash. In the functions, I declare the variable to return with 'my' which I'm finding out is bad. Should I declare variables to return from a function with 'our'? Do I need to m

Re: return array/hash ref from function

2004-05-12 Thread Wiggins d Anconia
> I have a number of functions in a program I'm writing that return a reference to > an array or hash. In the functions, I declare the variable to return with 'my' > which I'm finding out is bad. Should I declare variables to return from a > function with 'our'? Do I need to make sure I don't ha