in reply to Re: how can i use one handle for multiple files
in thread how can i use one handle for multifple files

File handles can go out of scope, if you use localized typeglobs.
{ local *FH; open FH, ">output.txt" or die "Can't write to file: $!"; print FH "Anything...\n"; printf STDERR "fileno for FH: %d\n", fileno(FH); } # ... open FH2, ">output2.txt" or die "Can't write to file: $!"; printf STDERR "fileno for FH2: %d\n", fileno(FH2);
The file handle will be closed when the block is exited. It is extremely likely that you'll see the same value for fileno() for both handles... (for this as a script, I expect to see the value 3) indicating that the first one was released, thus, the handle got closed.