... use strict; my $file = 'data_file.txt'; my $bad_pattern = '019'; open my $in_fh, "<$file" or die "can't open $file to read"; my @good_lines = grep { !/$bad_pattern/ } <$in_fh>; close $in_fh; open my $out_fh, ">$file" or die "can't open $file to write"; print $out_fh $_ foreach @good_lines; close $out_fh;
In reply to Re:^4 Deleting a line out of text file
by kesterkester
in thread Deleting a line out of text file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |