#!/usr/bin/perl use strict; my $total; my $num = 0; my $create_stamp; my $finished_stamp; while (<>) { if (/CREATE FILE/) { my @fields = split(/ +/); $create_stamp = @fields[1]; } elsif (/FINISHED LOADING/) { my @fields = split(/ +/); my $this_time; $finished_stamp = @fields[1]; $this_time = $finished_stamp - $create_stamp; if ($num == 0) { print ("First run: $this_time \n"); } $total += $this_time; $num++; } } printf ("Average for $num runs: %s\n", $total / $num);