my @files = qw(file1 file2 file3); # your log-files for (1..scalar(@files)){ next unless(-e $files[$_-1]); my $pid=fork(); if($pid==-1){ warn($!); last; } if($pid){ $pids{$pid}=1; } else{ # do what you want with $files[$_-1] exit(0); } } while(keys %pids){ my $pid=waitpid( -1, WNOHANG ); die "$!" if $pid == -1; delete $pids{$pid}; }
In reply to Re: Forking and running all child processes at the same time
by reneeb
in thread Forking and running all child processes at the same time
by chanakya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |