in reply to Re^4: print() on closed filehandle WRITE_FH
in thread print() on closed filehandle WRITE_FH

Here's another way to look at it:

open(FH, '>', $filename) or die "cannot open file"; select FH; # make print() use FH by default ... close FH; # close the filehandle print() is using by default ... # try to print() to closed FH by default (no other filehandle specifie +d # for print(), no other open filehandle has been select()-ed) print "Three Rings for the Elven-kings under the sky,\n"; # warning: "print() on closed filehandle FH at ..."
Solution: Don't use select: Use explicit filehandles for I/O operations.


Give a man a fish:  <%-{-{-{-<