#!/bin/perl -w use strict; my $file="dogy"; open(FH, "+<$file"); flock(FH, 2); my @newEntries; while(my $line = ) { chomp($line); if ($line%2==1) { next; } push(@newEntries,$line); } seek FH,0,0; foreach my $ent (@newEntries) { print FH $ent . "\n"; } truncate FH, tell FH; close(FH) #### #!/bin/perl -w use strict; my $file="dogy"; open(FH, "+<$file"); flock(FH, 2); my @newEntries; while(my $line = ) { chomp($line); if ($line%2==1) { next; } push(@newEntries,$line); } seek FH,0,0; truncate FH, 0; foreach my $ent (@newEntries) { print FH $ent . "\n"; } close(FH)