2011-04-03 09:37:12.129 (INFO, ICELineHandler.cpp:339) Product Def MarketID 90120253, Symbol 'BRN FMU0012_OMCA0000118502081312' 2011-04-09 21:32:15.525 3509,3523: Gap detect on 233.156.208.41:20041 from 2746318 to 2746373, moving to next message 2011-04-09 21:32:15.585 3509,3523: Gap detect on 233.156.208.41:20041 from 2746420 to 2746475, moving to next message 2011-04-09 21:32:15.639 3509,3522: Received data on ConnectionICE-Options. Pending=214044. 2011-04-03 09:37:12.129 (INFO, ICELineHandler.cpp:339) Product Def MarketID 90120253, Symbol 'BRN FMU0012_OMCA0000118502081312' #### #!/usr/bin/perl use strict; use warnings; use diagnostics; use Data::Dumper; my $Messages = { '21:32:15.111' => ["233.156.208.11:2004", "214111"], # Using the Time Stamp as a key '21:32:15.222' => ["233.156.208.22:2004", "214222"], # to an anonymous array containing '21:32:15.333' => ["233.156.208.33:2004", "214333"], # milliseconds and "Pending Number". }; print Dumper($Messages); # Used to check the contents of your variables. __END__ $VAR1 = { '21:32:15.222' => [ '233.156.208.22:2004', '214222' ], '21:32:15.111' => [ '233.156.208.11:2004', '214111' ], '21:32:15.333' => [ '233.156.208.33:2004', '214333' ] }; #### while ( $line = ) { unless (($data[10] =~ m/Pending=/) || ($data[6] =~ m/Gap/)) { next; } # skip elements we don't want if ($line =~ m/Pending=/) { my @data=split(/ /,$line); # split the line up $data[10] =~ s/[A-Za-z=.]//g; # delete "Pending", "=" and "." $data[1] =~ s/\..*//g; # delete the millisecond element of the (line)lTime var my @lTime=split(/:/,$data[1]); # split the line time my $lSecs=$lTime[0] * 3600 + $lTime[1] * 60 + $lTime[2]; # convert line-time to seconds if (($data[0] eq $ymd) && ($data[10] >= $tHold) && ($lSecs >= $sSecs) && ($lSecs <= $eSecs)) { $line = "$data[1],$data[10]"; } } #### m/(?:Pending=)(\d{6})$/ # If you want the number after 'Pending'. m|\s(\d\d:)+(\d){2}\.(\d){3}\s| # To match the time stamp.