Christopher J Bottaro wrote: > > hmm, something is going off in my head that says this is scary.
Calm down Christopher. :-) > @array is > local to the function (lexically scoped as you would say in perl??) and you > are returning a reference to it. Yes, that is correct. > well when the function goes out of scope, > isn't @array deallocated (popped off the stack) and now that reference you > returned is pointing to garbage? No, as long as there is still a reference to the array the data is available. > or is perl's garbage collection sophisticated enough to realize the difference > between: > myfunc(); > and > my $ref = myfunc(); > and not deallocate @array in the second example? Yes, that is correct. > also, i do understand that [ @array ] constructs and anonymous array, copies > @array into it, then returns a reference to to the new anonymous array. as > opposed to \@array which merely returns a reference to something that already > exists. Yes, that is correct. > but i guess my questions is...well, i asked it above...about whether > or not @array will still be in existance when the function ends... If you assign the reference to a scalar, then yes. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]