#!/usr/bin/perl use Win32::Process::Info; use strict; use warnings; my @models = { "model1", "model2"}; my @cpus = ( 2, 4); foreach my $model (@models) { foreach my $cpu (@cpus) { my $cmdstring = "\"myapp.exe\""; $cmdstring .= " NPROCESSORS=$cpu"; $cmdstring .= " $model"; $cmdstring .= " > nul"; system($cmdstring); } }