use strict; use warnings; use Symbol qw(geniosym); my $FH = 'scalar'; open FH,'>','test.txt' or die; print "File n. of FH before: ", fileno FH , $/ ; *FH = geniosym; # as choroba noted the following 2 statements are not useful. # for sure I dont understand the docs: # Symbol::geniosym creates an anonymous IO handle. This can be assigned into an existing glob without affecting the non-IO portions of the glob. # # undef $::{FH}{IO}; # delete $::{FH}{IO}; print "File n. of FH after: ",( fileno FH ? fileno FH : '-NA-'), $/ ; print "SCALAR slot of FH: ",$FH, $/;