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

 while (<>) { ... }
will process line by line, when you need what appears to be 3 lines at a time. Or you need to keep track of every set of three (perhaps using $.)

Also, I don't suggest calling open inside the while loop.

Update:

Just noticed you're using $1, $2 and $3. For those three expressions, only $1 will be used, and overwritten each time. I suggest storing $1 in a variable until you're ready to use it after each expression, like:

/^Sen = (\S+).*/; $sen = $1; /^Acc = (\S+).*/; $acc = $1; /^Cor = (\S+).*/; $cor = $1


Updated as per merlyn's observation:

$sen = $1 if /^Sen = (\S+).*/; $acc = $1 if /^Acc = (\S+).*/; $cor = $1 if /^Cor = (\S+).*/; push @array, $sen, $acc, $cor;


But as mentioned before you'll have to do something different to get the array entries you want.
--------------
It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs

Replies are listed 'Best First'.
Re^2: How do I process multiple files in parallel?
by merlyn (Sage) on Feb 25, 2005 at 18:33 UTC