while(1){ # a bunch of stuff $command = some calculated command; $args = some calculated args; $proc{"$command $args"} = Proc::Background->new("$command $args 1>&2 >some.log") unless $proc{"$command $args"}->alive; # a bunch of stuff }