Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://184987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-26 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found