use Proc::Background; my $proc; my @commands=($cmd1,$cmd2); foreach my $foo (@commands) { $proc = Proc::Background->new($foo); }