in reply to Process file simultaneously after forking
I've looked into perlipc but am not sure which strategy will work.
You don't say how big/complex the textfile is. Two ways that spring to mind - and which don't require any IPC - are to run a prefilter on the file. You could either just copy the file and then - depending on whether it was the forker or forkee read the odd/even lines. Or you could just slurp the entire file into an array and then use some cuuning manipulations to extract every other line. Something like
my (@odd, @even); map { if($.&1){ push @odd,$_;} else { push @even,$_ } } while(<FILE>);
Dingus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Process file simultaneously after forking
by Aristotle (Chancellor) on Nov 15, 2002 at 16:34 UTC |