in reply to Re: Unpredicted late destruction
in thread Unpredicted late destruction

You're right- the last example is a straightforward case of things working exactly how I should've expected them to. I think I shouldn't have tried to toss that example together at the last minute as I did, because now that I look at it, it's obvious why it's doing what it's doing: the object still exists.

Not only that, when I change "return $x" to "return $fn", $x is destroyed Before the body of the for() loop, which disproves my contention that this is happening to All lexically scoped variables in functions called in a for() LIST.

So now I guess I'd just like an idea of why filehandles aren't closed when I'd expect them to be :)

Sorry about the variable names.

Thanks,

Alan