in reply to Deleting a line from a file
I hope that helps.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);
|
|---|