in reply to ranking number of occurances

If you really want to
compare the number of times a string occurs in a set of files
as opposed to lines in which the pattern occurred, you'll need to add to the hash's value:
$hash{$_} += $c;

for your code, or

$hash{$_} += $c if $c;

for ikegami's

Replies are listed 'Best First'.
Re^2: ranking number of occurances
by ikegami (Patriarch) on Mar 16, 2008 at 23:42 UTC

    I don't think so. Your code says that line/file "a48754a4397543a43753a" contains "a" 8 times. Even if $_ represents a file instead of a line, no change is needed.

    If he wants the total, then he'd need

    $hash{$_} = $c; # Per line/file count $total += $c; # Total count