## simplified code, so no error checking... foreach my $node (@devices) { my $pid = fork(); if( !$pid ) { ## child... exit 0; } ## parent wait(); }