#!/usr/bin/perl @LIST = ('A','B','C','D','E'); $i=0; for (@LIST) { if ($pid = fork) { if (defined $pid) { $letter= $LIST[$i]; print "$letter is in position $i, with pid $pid\n"; print "That's what I said... $letter is in position $i, with pid $pid\n"; exit 0; } else {die "Error in forking at $i: $!\n";} } $i++; }