use strict;
use IO::Socket::SSL;
foreach (1 .. 5) {
my $pid = fork();
next if $pid;
random();
random();
exit;
}
sub random {
print sprintf("Process %d: %d", $$, int(rand(100000))), "\n";
}
####
$ perl fork_rand.pl
Process 13788: 32768
Process 13788: 3778
Process 13789: 32768
Process 13789: 3778
Process 13790: 32768
Process 13790: 3778
Process 13791: 32768
Process 13791: 3778
Process 13792: 32768
Process 13792: 3778
####
$ perl fork_rand.pl
Process 13806: 94050
Process 13806: 14790
Process 13807: 89099
Process 13807: 93200
Process 13808: 48447
Process 13808: 14001
Process 13809: 28378
Process 13809: 71603
Process 13810: 44245
Process 13810: 86800