http://www.perlmonks.org?node_id=356055


in reply to Re: Re: sub returning undef
in thread sub returning undef

Well, in the 'local' sense of local, I'm not sure. You should be using the 'local' keyword only to temporarily overload some global variable ( mainly anyway ).

In the 'my' sense, which is really 'lexical' I believe, no.

By returning by reference, you've added a second reference to the same data. The original dissapears, leaving you with 1 again. The data won't be nuked until you get to zero references to the data.

Replies are listed 'Best First'.
Re: Re: Re: Re: sub returning undef
by melora (Scribe) on May 31, 2004 at 19:48 UTC
    Ah, I see. Please forgive me; I'm still just beginning to learn about references. Thanks.