foreach $pid (@p_s) { #...rest of scheduler loop }