[Israel.pm] Garbage Collection Question

Yuval Yaari yuval at windax.com
Sat May 8 08:21:44 PDT 2004


Let's say I have a small script:

open(FILE, "<bigfile") or die($!);
# Slurp the entire file into a scalar.
my $file = do { local $/; <FILE> };

## END CODE ##

And then the code continues to run forever (or at least, let's assume it
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??? :)


More information about the Perl mailing list