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.