Elizabeth Mattijsen <[EMAIL PROTECTED]> writes: >At 04:59 PM 8/12/02 +0100, Nick Ing-Simmons wrote: >> >I'm not sure I'm following you here... Could you elaborate? >>tie @tied_array; # 10000 elements say >> >>foreach my $value (@tied_array) # 10000 extra SVs tied to elements >> { >> print $value; >> } # all freed here >> >>foreach my $i (0..$#tied_array) >> { >> my $value = $tied_array[$i]; # Just one extra SV tied to an element >> print $value; >> } # free'd / reused here > > From Arthur's description I got the impression that there wouldn't be any >difference in these approaches. Both will do a FETCH and store it in an SV >associated with the element. It's just that in the first case this happens >when building the list in foreach(), the second it is when fetching it >inside the loop. > >Am I reading Arthur's explanation the wrong way then?
There need only be one "slave element" SV per array - the "slaves" are not stored in the 'local' array - just returned by FETCH. -- Nick Ing-Simmons http://www.ni-s.u-net.com/