Kozz has asked for the wisdom of the Perl Monks concerning the following question:
As I was writing up some subroutines in some scripts I was doing, I got to remembering reading someone's comments, "why thrash memory?". And indeed, we can all agree that if you can lessen the total memory used by your script that it's a good thing, no?
So here's my question: When is it important to undef($variable) simply for the sake of being "nice" to memory? If the variable is going out of scope in another 0.25 seconds, should I forget about undefining that value? Or more importantly, when is it imperative that you undefine something?