--- [EMAIL PROTECTED] wrote: > Hi to All, > I' d like to know if it' s possible to count the exact number of files > inside a certain directory, using a way better than this:
perl -e 'opendir D,".";$count=grep{-f}readdir D;print $count' That breaks out to: opendir DIR, $dir or die "Cannot open $dir: $!"; # grep returns a list, so accessing it scalar context # returns the number of items in the list my $count = grep { -f } readdir DIR; closedir DIR; Cheers, Curtis "Ovid" Poe ===== Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]