#!/usr/bin/perl -lw use strict; # necromancer my $zombie,$|++,print $/; $SIG{TERM} = sub { hit $zombie; destroy $zombie and return unless $zombie->walks; print qq|"BRAINS!" (|,$zombie->health,' left)'; }; for (1..6) { next if fork; $zombie = raise Zombie; sleep 1 and regen $zombie while 666; } package Zombie; sub raise {print "$$ rises" and bless {hits=>int(rand 5)+2},shift} sub hit {shift->{hits}--} sub walks {shift->{hits} > 1} sub health {$_=shift->{hits};$_ > 1 ?"$_ hits":"$_ hit"} sub regen {shift->{hits}+=3 if int(rand 2)} sub destroy{print qq|"brainsss..." zombie destroyed| and exit}