# real file perl -Mstrict -wE "open my $fh,'<','out.log' or die;say fileno($fh) ? 'FileHandle! '.fileno($fh):'NA'" FileHandle! 3 # memory file perl -Mstrict -wE "open my $fh,'<',\my $mem or die;say fileno($fh) ? 'FileHandle! '.fileno($fh):'NA'" FileHandle! -1 # not existing file, closed filehandles, aliens things.. perl -Mstrict -wE "open my $fh,'<','out.logXX';say fileno($fh) ? 'FileHandle! '.fileno($fh):'NA'" NA