This might be helpful: use this concept:
my @matches = ($line =~ /$regexp/);
where whatever is matched within parentheses in the regexp will be output to the elements of
@matches.
So, if the '987' that you are matching always occurs in the same place, then within your loop you could do something like:
my $regexp = "\d+: (\d+):(\d+):(\d+),\d+,\d+,(\d+)\.+$";
my ($hr,$min,$sec,$match) = ($field =~ /$regexp/);
if ($match == '987') {
... #do whatever you have to do with $hr,$min,$sec
I'm sure there are better ways to do the regexp, but I do it like that because that's the way I understand it.
My point is that I prefer to split it up all at once by fishing out your values with one regexp, as opposed to splitting and splitting.
Hope this helps....