use warnings; use strict; use File::Find; my %hash; my @temp; my $dir = shift @ARGV; die "Give me a directory to search\n" unless (-d "$dir"); File::Find::find (\&wanted,"$dir"); print "-"x20,"\n"; foreach my $key (sort keys %hash) { print $key, "\t:\t",$hash{$key},"\n"; } sub wanted { # don't attempt to read a directory. return if (-d $_); my $fname = $File::Find::name; @temp = split(/[\/\\]/, $fname); $fname = $temp[-1]; # Make sure there is an extension. We check for a # trailing period even though on Win32 it shouldn't happen if (($fname =~ /\./) && !($fname =~ /\.$/)) { $fname = lc($fname); @temp= split(/\./, $fname); $hash{$temp[-1]}++; } else { $hash{"no ext"}++; } }