my $io = new IO::Handle; open (my $fh, '<', $FILE) or die $!; if ($io->fdopen(fileno($fh), "r")) { ...