On Mon, 2005-06-13 at 17:07 +0200, Ingo Blechschmidt wrote: > # No problem: > my $data = BEGIN { > my $fh = open "some_file" err...; > =$fh; > }; > > # Problem; > my $fh = BEGIN { open "some_file" err... }; > # Compile-time filehandle leaked into runtime! > say =$fh;
Perhaps I'm being very naive, but why is this a problem? Maybe it's not the best way to do something, but I can see it being useful in some circumstances. Are you worried about using up resources? If you don't refer to $fh elsewhere, GC will take care of it. (If you really worried about it, you'd explicitly close it somewhere.) -- c