Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Oedipus Rex

by nothingmuch (Priest)
on Jun 28, 2002 at 00:43 UTC ( #177897=poem: print w/replies, xml ) Need Help??

Laius, Oedipus's father is one perl program:
#!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() };
Whilst Jocasta, Oedipus's mother, and the parent process is another:
#!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 } }
sorry about the line wraps, but i guess it's not that important... nothingmuch/nothingmuch@mac.com

Replies are listed 'Best First'.
Re: Oedipus Rex
by CiceroLove (Monk) on Jul 09, 2002 at 03:01 UTC
    This is unbelievably fucking brilliant! I submit that the vast majority of the Perl (and by extension the general) public will miss the finer points of this clever repartee de Perl. Kudos to you and your liberal (not in a political sense) education.

    CiceroLove
    Fates! We will know your pleasures: That we shall die, we know; 'Tis but the time, and drawing days out, that men stand upon. - Act III,I, Julius Caesar

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://177897]
Approved by Mandor
Front-paged by jarich
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2021-08-05 18:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (44 votes). Check out past polls.

    Notices?