Time will be your friend here.
Something like
use strict;
my ($start_time, $end_time, $time_used);
my $input;
print "Hit enter to start\n";
while (<STDIN> !~ /q/) {
$start_time = time;
print "Hit enter to stop\n";
$input = <STDIN>;
$end_time = time;
$time_used = $end_time - $start_time;
print "That took $time_used\n";
print "Hit enter to start, q <enter> to quit\n";
}
This uses time so it only has 1 sec granularity. This means that for small time values
The error involved in counting could be a large part of the result.
To display to the screen, you would have to use non blocking io to get the start and stop enters.
Hope this gives you some direction.
Crulx