shemp has asked for the wisdom of the Perl Monks concerning the following question:
Now my concern is that when writing @$big_arrayref, that dereferences the array, and makes a copy. In and of itself, foreach() hasnt made a copy since old versions of perl, but that deref will.sub get_big_arrayref { # blah blah blah return \@big_array; } { ... my $big_arrayref = get_big_arrayref(); foreach my $value (@$big_arrayref) { # whatever } }
Or at least i think this doesnt do any sublte dereferencing.for my $i (0 .. $#$big_arrayref) {
And i dont see any way around this problem.while ( my($key, $value) = each %$big_hashrerf ) {
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dereferencing woes
by davido (Cardinal) on May 05, 2004 at 19:20 UTC | |
by dave_the_m (Monsignor) on May 05, 2004 at 21:03 UTC | |
|
Re: Dereferencing woes
by japhy (Canon) on May 05, 2004 at 18:55 UTC |