On Mon, 28 Apr 2008, Bram wrote: >>> A proper fix would be to add an "invisible" block around the if. That >>> would slow down all ifs a bit, though. >> >> I don't think that works either: >> >> perl -Mstrict -le 'if (1) { if (open(my $fh, q(/etc/passwd))) { print >> "inner"; } } system(qq(ls -l /proc/$$/fd));' >> >> Shows that the filehandle just isn't closed AT ALL (until program exit). >> > > perl -Mstrict -le '{ if (open(my $fh, q(/etc/passwd))) { print "inner"; } } > system(qq(ls -l /proc/$$/fd));' > > Shows that the filehandle is closed. Oh interesting. So it's specific to if() blocks. That's a huge relief and I consider it way less of a showstopper - I thought the file was remaining open until END{}. Matt.Thread Previous | Thread Next