Chris,

I'll take a stab at this to see if my understanding of Perl is correct.

Your first subroutine is acceptable under Perl, but it wouldn't be
under C++.  The reason is that Perl has automatic reference counting
and garbage collection.  Perl counts the number of references there are
to data elements.  When you create $aref, the reference count of the
anonymous array is set to 1.  When the subroutine ends and you would
expect the array to disappear, Perl checks the array's reference count.
 Since the reference count is 1, the array is kept in memory.  If the
variable into which the reference is stored in the calling program goes
out of scope, the reference count on the array will go to zero, and
Perl will be free to release the array whenever it wants to, but I
think I read that you can't influence the moment when the array will
actually go away.

Gurus, am I correct?

Rob



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to