It isn't that Perl remembers how much memory a variable used as much as it is that Perl spent all that effort allocating it earlier, and isn't about to get rid of it just yet, as there is a high probability, in general, that if a lot of memory is needed once, it will be needed again.