On Mon, Dec 31, 2007 at 02:43:44PM -0800, gst wrote:

> hi,
> 
> iirc, in C if I store somwhere a pointer to a "stack" value (e.g.:
> call a function with an auto variable, return its pointer) i know i'm
> going to mess things, since that piece of data will be most probably
> overwritten by subsequent calls.
> 
> if I do the same in Perl (with a hard ref), do I have any guarantee
> that the same behavior (implicit aliasing) does - or does not (every
> new scalar is guaranteed to not alias the old non existant value) -
> apply?

In addition to the answers you have received, you will be pleased to
hear that in contrast to C, Perl doesn't do variable suicide in the
manner you have described.  Variables are reference counted, and will
not be destroyed until the last reference to them is deleted.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to