I have put this ugly looking thing together.. which does seem to work..
use strict; my $input = "quotes.txt"; my ($quote,$time); my $actualquote; my $actualtime; my $hour; my $minute; my $second; my $picksecond; open(DATAFILE, "$input") || die("Can't open $input:!\n"); $picksecond =1; while (<DATAFILE>) { chomp $_; ($quote,$time) = split(",", $_); ($hour,$minute,$second) = split(":",$time); if ($second==0) {$actualtime=$time; $actualquote=$quote;$picksecond=99;} if ($second>$picksecond) {$picksecond=$second;$actualtime=$time; $actualquote=$quote;} print "$quote\t$time\t$second\n"; } print "$picksecond\t$actualtime\t$actualquote\n";
Does anyone care to comment on my code..??
i have another outstanding issue..
when i have a messed up time field e.g 17:30:07fg
how do i get the split command to ignore any characters after the 2 seconds digit? thanks.
In reply to Re: reading a delimited file and selecting values from it
by Conal
in thread reading a delimited file and selecting values from it
by Conal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |