Perhaps use grep for that?return $count - 2; #maybe not the best way of removing . and . +.
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; }
In reply to Re^2: How to tell if a Directory is Empty
by ciderpunx
in thread How to tell if a Directory is Empty
by ishootperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |