in reply to Re: file ext counter.
in thread file ext counter.

ah, I see why you'd want to use  $hash{@temp[-1]}++ but this exhibits bad behavior for files with no extention at all! update

your

if (($fname =~ /\./) && !($fname =~ /\.$/)) { $fname = lc($fname); @temp= split(/\./, $fname); $hash{$temp[-1]}++; } else { $hash{"no ext"}++; }
seems a little clumsy. consider
if ($#temp >0) {$hash{@temp[-1]}++} else {$hash{""}++}
which sees if there's more than 1 bucket in @temp. If there is, we know the lastmost one's the extention. If there isn't we know the filename has no extention. in fact, I think this can be shortened to <code> if ($#temp) <code> but that's not a big deal. I kept the hash named "" for the highly special case of a file, e.g. "foo.no ext"