http://qs321.pair.com?node_id=254124


in reply to fork-bomb!

If fork returns false, don't just assume you're the child. The returned value can be undef, which means fork failed. If you fail to check for undef, your code has very strange bugs when forking fails (which happens under heavy load, when you exceed resources, etc).

if (my $pid = fork) { # parent } elsif (defined $pid) { # child exit; } else { die $!; }
or one of the 1e6 other ways to write that.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }