in reply to 'my' Variable life cycle
...@x's contents remain, and $f now holds a reference to @x, such that $f->[0] eq 'a'. But here:sub foo { my @x = qw(a b c); return \@x } my $f = foo();
...@x can be garbage-collected as normal, since the reference to @x gets dropped on the floor.sub foo { my @x = qw(a b c); return \@x } foo();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 'my' Variable life cycle
by ikegami (Patriarch) on Mar 09, 2008 at 04:21 UTC | |
|
Re^2: 'my' Variable life cycle
by Anonymous Monk on Mar 07, 2008 at 15:30 UTC | |
by chromatic (Archbishop) on Mar 07, 2008 at 16:06 UTC | |
by dsheroh (Monsignor) on Mar 07, 2008 at 17:26 UTC |