![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re^4: Shrunk array takes more memory than originalby dave_the_m (Monsignor) |
on Nov 10, 2015 at 13:12 UTC ( #1147356=note: print w/replies, xml ) | Need Help?? |
Because using $#array causes some magic to be attached to the array.Technically speaking, a temporary magic object is created that points to the array. When the object is assigned to, it truncates the array. This object is freed (well, returned to the pool anyway) at the end of the statement. The array itself never gains any magic. Dave.
In Section
Seekers of Perl Wisdom
|
|