[Israel.pm] Garbage Collection Question
Yuval Yaari
yuval at windax.com
Sat May 8 08:21:44 PDT 2004
Hi,
Let's say I have a small script:
## PSEUDO-CODE ##
open(FILE, "<bigfile") or die($!);
# Slurp the entire file into a scalar.
my $file = do { local $/; <FILE> };
close(FILE);
## END CODE ##
And then the code continues to run forever (or at least, let's assume it
will).
Will Perl automagically get rid of $file after the last line I used it in
(in case reference count == 0, of course), or would it be better to set it
to undef?
AFAIK Perl should get rid of it, leaving my RAM alone.
Any cases, except for ref count > 0, when it won't?
Don't you just love this language??? :)
--Yuval
More information about the Perl
mailing list