Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Reference to a non-primitive (e.g. hash) local function variable is returned to the caller

by Perlbotics (Chancellor)
on Sep 21, 2011 at 09:46 UTC ( #927115=note: print w/replies, xml ) Need Help??


in reply to Reference to a non-primitive (e.g. hash) local function variable is returned to the caller

Short: It's possible and legal.

It's non best-practice programming for languages like C, C++, etc. where returning pointer to object from the stack is an error. But this is Perl and Perl usually keeps track of the variables in use (ref-counts) and garbage collects them when necessary.
There are edge-cases with cyclic dependencies though (see: weaken in Scalar::Util).

  • Comment on Re: Reference to a non-primitive (e.g. hash) local function variable is returned to the caller

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://927115]
help
Chatterbox?
NodeReaper gets the Vote Fairy drunk

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2017-11-19 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (278 votes). Check out past polls.

    Notices?