in reply to recursive file open
Not that way, no. Filehandles (of that form) are global and when you reopen one the previous file is closed. Either localize it with, erm, local or use a lexical handle (given a new enough Perl).
open( my $hosts_fh, "<", $file ) or die "probelm opening '$file': $!\n +";
|
|---|