in reply to Deleting a line from a file

Here is a quick hack I put together (I assumed that you only have NAME, ID, and TIME as fields).
my $time = 50; while (<IN>){ @tmp_split = split /:/,$_; # Print the previous entry if valid print OUT "NAME:$tmp_hash{\"NAME\"}ID:$tmp_hash{\"ID\"}TIME:$tmp_hash{ +\"TIME\"}" if ($tmp_split[0] eq "NAME" && $tmp_hash{"TIME"} > $time); # Put the values in a hash for storage $tmp_hash{$tmp_split[0]}=$tmp_split[1]; } # Print the last entry if valid print OUT "NAME:$tmp_hash{\"NAME\"}ID:$tmp_hash{\"ID\"}TIME:$tmp_hash{ +\"TIME\"}" if ($tmp_hash{"TIME"} > $time);
I hope that helps.