open(FH,'file.200207') or die 'hlpfl err msg';
while(<FH>) {
# get name
$name = (split /\s+/, $_)[0];
# init count
$info->{$name} = 0;
}
for('file.200204','file.200205','file.200206') {
open(FH, $_) or die 'nther hlpfl err msg';
while(<FH>) {
# get name
$name = (split /\s+/, $_)[0];
# update count
if(defined $info->{$name}) { $info->{$name}++ }
}
}
Just a suggestion. Haven't tested it, so use with caution.
update: Hmm... I see fuzzyping has posted a very valid solution to your problem too ... only he keeps track of the name appearing in individual files, and I keep the entire sum. I didn't even think about that-- I don't know what you meant in your original post (it looks like it could go either way from re-reading it), but there's yet another disclaimer :)