in reply to Checking number of lines in bzipped file
Does your "reading" part work without the call to fork?
Personally, I would just use a pipe from bzcat to read the file instead:
open my $fh, "bzcat '$file' |" or die "Couldn't spawn [bzcat '$file']: $! / $?"; while (<$fh>) { $number_of_lines++ };
Once that works, look at either using Dominus' runN script or re-wrap your script with the routine doing the "fork" calls. Alternatively, you can also look at Parallel::ForkManager to rate-limit your child programs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Checking number of lines in bzipped file
by Anonymous Monk on Apr 25, 2011 at 18:31 UTC |