#!/usr/bin/env perl
use strict;
use warnings;

@ARGV == 2 or die "Usage: $0 <start> <time>\n";

my ($start, $time) = @ARGV;
my $num = $start;

$SIG{ALRM} = sub { print "Process $$ exiting, after reaching $num\n";  exit(0) };
$SIG{HUP} = sub { print "Process $$ has incremented number from $start to $num\n"; };

alarm($time);

$num++ while 1;

__END__
<p>Write two programs.  The first, <code>child.pl</code> will be used to see how quickly
Perl can increment a number.  It takes two numbers on the command line.  The first is the
starting number.  The second is the number of seconds to run.  Before starting, set up two
signal handlers - one exit the program after the alarm
has gone off, using the incrementing number as an exit status, and one to print
the current value of the incrementing number when the signal <code>HUP</code> is received.
Once the signal handlers are set, enter an infinite loop in which the number starting with
the base is just incremented over and over. </p>
