Assuming a %stats hash has been declared, the File::Find callback can be as simple as:
sub wanted {
return unless -f;
/(?<!^)[.]([^.]+)$/;
++$stats{$File::Find::dir}{$1 || ''};
}
That will cause all files without an extension, as well as hidden files without an extension (e.g. .bashrc), to be counted together under a '' key.
Everything else will counted under keys without a leading '.', e.g. 'pl', 'txt', 'png', etc.
If counts for individual directories aren't required, that can be simplified even further by just using:
++$stats{$1 || ''};
|