#!/usr/bin/perl use 5.18.3; use warnings; chomp (my @words = ); my %cnt = map { $_ => 0 } @words; foreach my $tf (glob "*.log") { printf STDERR " %-40s\r", $tf; open my $fh, "<", $tf or next; while (<$fh>) { $cnt{$_}++ for grep { exists $cnt{$_} } m/(\w+)/g; } } printf "%-20s : %6d\n", $_, $cnt{$_} for sort { $cnt{$b} <=> $cnt{$a} } @words; __END__ tux dromedary camel dream milk druid monk wizard azaghal perl