in reply to Re: array reference
in thread array reference
In C, resizing an array invalidates existing pointers to the array.
int* a; a = (int*)malloc(...); int* b = a; a = (int*)realloc(a, ...); /* b now contains garbage */
The OP was asking if the same happens in Perl.
my @array; my $aref = \@array; push @array, ...; # Is $aref still valid? Yes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: array reference
by blue_cowdawg (Monsignor) on Aug 22, 2007 at 17:07 UTC |