#!/usr/bin/perl -w open FILE1,"out.prod" or die "Cannot open file $!"; @rec=; %save=(); foreach $x (@rec){ if ( $x =~ /2005/ ){ chomp($first=$x); $save{$first}=undef;} if ( $x =~ /time/ ){ chomp($lat= $x); $lat =~ s/.*?time=(\d+)\.\sms$/$1/; if( $lat > "10" ){ $save{$first}=$lat; #print "$first is $save{$first}\n"; } } } foreach $first (sort keys %save){ if ($save{$first}){ print "$first is $save{$first} ms.\n"; } }