sub isEmpty3 { return undef unless -d $_[0]; opendir my $dh, $_[0] or die $!; my $count = grep { ! /^\.{1,2}/ } readdir $dh; # strips out . and .. return $count; }