Rob Dixon <[EMAIL PROTECTED]> wrote:
: sub nfiles {
: opendir my $dh, $_[0] or die $!;
: my @dir = readdir $dh;
: return scalar @dir;
: }
That should be decremented by 2 to account for '.'
and '..'. It could also get the count using '()':
sub is_empty_dir {
return undef unless -d $_[0];
opendir my $dh, $_[0] or die $!;
my $count = () = readdir $dh;
return $count - 2;
}
HTH,
Charles K. Clarkson
--
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]