> -----Original Message-----
> From: Michael Fowler [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 25, 2001 5:26 PM
> To: Yacketta, Ronald
> Cc: Beginners (E-mail)
> Subject: Re: clearing memory
>
> ...
> The ideal solution would be to use
> lexical variables that go out of scope before it starts
> another iteration.
Yes, Michael that is the ideal solution. I was hung up on the OP's concern
over globals. But you can even do the same thing with globals by using the
"local" declaration:
while (1)
{
do_stuff();
sleep 30;
}
sub do_stuff
{
local ($var1, $var2);
# load huge stuff into $var1, $var2, etc.
# these are globals that can be seen in any sub called
# from here (unlike "my")
# when do_stuff ends, "local" copies of $var1 and $var2
# are freed
}
This is a technique I use every day in my Apache::Registry scripts.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]