$ perl -lwe 'opendir my $f, "." or die $!; stat $f' stat() on unopened filehandle $f at -e line 1. (Are you trying to call stat() on dirhandle $f?)