in reply to Local(*FILE);
Additionally it has another effect: when you leave that scope the filehandle is closed automagically:
use warnings; { local *T; open(T, ">foo") || die; print T "HALHGLAG\n"; # Works okay! } print T "Surprise!\n"; # warns "print() on closed file..."
|
|---|