sub get_first { # usage: get_first("firstfile"); my $f1=shift; # first file tie my @file1, 'Tie::File', "$workdir$f1" or die("Can't tie $f1: $!\n"); my $first=@file1[0]; untie @file1; my ($dow, $month, $day, $time, $year, $line)=split(/\s+/, $first); my $start_time=join ' ', $month,$day,$year,$time; return $start_time; } sub get_last { # usage: get_last("lastfile"); my $f2=shift; # last File tie my @file2, 'Tie::File', "$workdir$f2" or die("Can't tie $f2: $!\n"); my $last=@file2[$#file2]; untie @file2; my ($dow, $month, $day, $time, $year, $line)=split(/\s+/, $last); my $end_time=join ' ', $month,$day,$year,$time; return $end_time; }