|Syntactic Confectionery Delight|
Re: Why does Perl allow you to return array references to variables in local scope?by BrowserUk (Pope)
|on Oct 16, 2013 at 12:34 UTC||Need Help??|
I think the easiest way to think of it is that: names have scope; data lives as long as it is referenced.
So whilst the name @arr has gone out of scope; the data that it labeled whilst in-scope, continues to persist, because a reference to it was returned to the caller.
Hence, if you call DoSomething() in a void context - ie. you don't assign the return reference to a name in the calling scope -- then the returned reference will be discarded, and the data it references -- formerly known as @arr -- will no longer be referenced and so will be returned to the process memory pool for reallocation.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.