Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Searching Files

by dimmesdale (Friar)
on Jul 24, 2002 at 19:14 UTC ( [id://184987] : note . print w/replies, xml ) Need Help??

in reply to Searching Files

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 :)