//SNAGIT.TXT eg top of the hour 1.29133 ,01:59:34 1.29132 ,01:59:59 1.29132 ,01:59:59 ..... #### //SNAGIT.TXT e.g bottom of the hour 1.29020 ,01:29:52 1.29036 ,01:30:02 1.29035 ,01:30:12 .... #### use Time::ParseDate; use Time::Local; ... my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdist) = localtime time; my $month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)) [(localtime)[4]]; my $day = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]]; $year = $year+1900; my $input = "SNAGIT.txt"; my $actualquote1=0; ## Open the SNAGIT.TXT, plus some sensible error checking open(DATAFILE, "$input") || die("Can't open $input:!\n"); ## Loop through the file one line at a time while () { chomp; if ( m{^ (\d\.\d{5}) \s*,\s* (\d\d:\d\d:\d\d) \s* (.*) $ }x ) ## 1.XXXXX { my ( $quote, $linetime, $comment ) = ( $1, $2, $3 ); # captures my ( $snaghour, $snagminute, $snagsecond ) = split /:/, $linetime; chop($quote); if (parsedate($snaghour.":".$snagminute.":".$snagsecond) <= parsedate($hour.":".$min.":00")) { $actualquote1 = $quote; } } } close(DATAFILE);