I would use something like:
my $cnt = 0; local $_; chdir "/home/a" or die "chdir: $!"; opendir my $dh => "." or die "opendir: $!"; -f && /\.txt$/ && $cnt ++ while defined ($_ = readdir $dh); closedir $dh;
Abigail
In reply to Re: how to get total numbers of files in a directory?
by Abigail-II
in thread how to get total numbers of files in a directory?
by hweefarn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |