Proc::Queue::size(5); print "Starting some procs\n"; foreach my $switchName (@switchList){ #last; $ga->{'switchName'} = $switchName; my $hashRef = $ga->{'outputString'}{$switchName}; run_back { print "Working on $switchName\n"; print "Running remote script on $switchName \n"; my $cmd = `/usr/bin/ssh psg01\@$switchName /home/psg01/serverSnapshot.pl 2>/dev/null`; print "Getting the files from $switchName\n"; $cmd = `/usr/bin/scp psg01\@$switchName:/tmp/snapshot*.out /tmp/ >/dev/null 2>&1`; print "Got the files, time to Proces for $switchName\n"; processFiles(switchName=>$switchName, outputStringHashRef=>$hashRef); print " HEY!! I am so done with $switchName :-) \n"; } #last; } #die; 1 while wait != -1; print "Finished!\n"; Proc::Queue::size(30); foreach my $switchName (@switchList){ my $loadID = $ompLoadHash{$switchName}; my @formNames = sort keys %{$activeFormHash{$loadID}}; foreach my $formName (@formNames){ run_back{ my $db_input = "/tmp/snapshot.$switchName.$formName.input"; print "Going into DB for $switchName\n"; `psql test -U postgres -c "COPY $formName\_snapshot (parm_id, value, element_id, collect_date) from '$db_input'"`; unlink; print "I am done going into DB for $switchName on $formName :-{}\n"; } } #last; } 1 while wait != -1; print "Finished!\n";