Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How do I process multiple files in parallel?

by Sec (Scribe)
on Feb 25, 2005 at 16:09 UTC ( #434540=note: print w/ replies, xml ) Need Help??


in reply to How do I process multiple files in parallel?

As others commented, you should probably move the open out of the while loop. You also need to save the matched values in some variables. In your case I would do it like this:

open (OUT,">Test")|| die; while (<>){ /^Sen = (\S+)/ && do {$sen=$1}; /^Acc = (\S+)/ && do {$acc=$1}; /^Cor = (\S+)/ && do {$cor=$1; push @array,$sen,$acc,$cor; $sen=$acc=$cor=undef; }; }'
Only if you encouter a "Cor" line (the last one of a block) handle the values you accumulated. And don't forget to clear them, just in case your input file is missing some lines.


Comment on Re: How do I process multiple files in parallel?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-03-07 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (182 votes), past polls