Whilst Jocasta, Oedipus's mother, and the parent process is another:#!perl -w my $jocasta = '/dev/jocasta'; # laius marries jocasta # i reckon tis his kingdom the there roads are in, so let's let him bu +ild them, to the point where he and oedipus meet open FH,">/home/laius/crossroad"; print FH "$$\n"; close FH; symlink("/home/laius/crossroad","/dev/path1"); symlink("/home/laius/crossroad","/dev/path2"); symlink("/home/laius/crossroad","/dev/path2"); # he open a named pipe to his wife if ( system('mknod', $jocasta, 'p') && system('mkfifo', $jocasta) ){ die "mk{nod,fifo} $path failed (maybe i have body odor?)"; } no strict; # the device was yet to be invented # i think this is obvious open STDOUT,">$jacosta"; my $stamina = times(); while(times()-$stamina < 40){ # starting to age, are we? close STDOUT; open STDOUT,">$jacosta"; } my $fertility = (20_000_000 + rand (110_000_000)) * 2 *(1+rand()); # a +pproximate sperm count # many different sperm cells! for (my $i = 1; $i < $fertility; $i++){ print "sperm variation ".(1_000_000_000 * rand() * rand() * rand() + * rand())."\n"; } close STDOUT; # we're done NOP: { sleep 10; # not a successful spouse redo NOP; } $SIG{__WARN__} = sub { oracle() };
sorry about the line wraps, but i guess it's not that important... nothingmuch/nothingmuch@mac.com#!perl INIT { # she reaches puberty, i guess open STDIN,"/dev/jocasta'"; # and at some point no strict; } @sperm = <STDIN>; @sperm = grep { $_ = not $_ } @sperm; # about half make it in @sperm = grep { $_ > .5 } @sperm; # weak ones die later @sperm = sort { $b <=> $a } # fittest are ahead @sperm = @sperm[0 .. int($#sperm / 2)]; # the weaker ones die still $winner = shift @sperm; # one makes it, and undef @sperm; #the rest die sleep(9 * 30 * 24 * 60 * 60); # approximately 9 months later give_birth('oedipus'); # later came oedipus and made 4 little buggers for (my $i = 1; $i <= 4; $i++){ @sperm = <STDIN>; @sperm = grep { $_ = not $_ } @sperm; # about half make it in @sperm = grep { $_ > .5 } @sperm; # weak ones die later @sperm = sort { $b <=> $a } # fittest are ahead @sperm = @sperm[0 .. int($#sperm / 2)]; # the weaker ones die stil +l $winner = shift @sperm; # one makes it, and undef @sperm; #the rest die sleep(9 * 30 * 24 * 60 * 60); # approximately 9 months later give_birth($i); } kill KILL => $$; # oh my! she found out! sub give_birth(){ return if fork; # error checking is like crying over spilt milk. if ($_[0] eq 'oedipus'){ chdir("/"); # oedipus is disassociated fork && exit; $^W = 1; sleep (30 * 12 * 30 * 24 * 60 * 60); # approximately 30 years +later local $SIG{__WARN__} = sub { oracle() } open FH,"/dev/path".(int(rand(3)+.5)); local $_ = <FH>; close FH; kill KILL => $_; chdir("/home/jocasta"); # and he too my $jocasta = '/dev/jocasta'; for ($j = 0; $j < 4; $j++){ # four of them if ( system('mknod', $jocasta, 'p') && system('mkfifo', $jocasta) ){ die "mk{nod,fifo} $path failed (maybe i have body odor +?)"; } no strict; open STDOUT,">$jacosta"; my $stamina = times(); while(times()-$stamina < 240){ close STDOUT; open STDOUT,">$jacosta"; } my $fertility = (20_000_000 + rand (110_000_000)) * 2 *(1+ +rand()); for (my $i = 1; $i < $fertility; $i++){ print "sperm variation ".(1_000_000_000 * rand() * ran +d() * rand() * rand())."\n"; } close STDOUT; } close STDIN; # and now he's blind } }
In reply to Oedipus Rex by nothingmuch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |