On Dec 31, 2007 2:43 PM, gst <[EMAIL PROTECTED]> wrote: > 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?
You can't do "the same" in Perl. Problem solved! Perl itself handles such things as memory management and the stack. Perl programmers rarely need to think about such things. If you try writing a test program that does what you're thinking of, you should see that Perl allocates new lexical variables as needed (and I shouldn't tell you this, but it doesn't really keep them on the stack), so your program won't segfault like a C program might. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/