Sequentially?
use strict; use warnings; foreach (@ARGV) { &process($_); }
In parallel?
use strict; use warnings; foreach (@ARGV) { die "Fork failed: $!\n" unless defined (my $pid = fork); exit &process($_) unless $pid; } 1 until -1 == wait; ...
Restrained parallel?
use strict; use warnings; my $max = 4; my $c = 0; foreach (@ARGV) { wait unless ++$c <= $max; die "Fork failed: $!\n" unless defined (my $pid = fork); exit &process($_) unless $pid; } 1 until -1 == wait; ...
I leave the process routine and appropriate error checking to you.
In reply to Re: Multiple Instances
by hbm
in thread Multiple Instances
by TheBasilisk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |