Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My attempt at reading it but how would I delete the line with 019 in it??234 324 2323 232 344 1213 019 232 343 #delete this line 344 343 324
$fil = 'file.txt'; open(DATA, "$fil") || die "cant open: $!\n"; foreach $line (<DATA>) { if($line =~ /$var/gi) #in this case the variable would be 019 { print "data exists now need to delete it"; s/$var//; #this is not working } } close(DATA);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Deleting a line out of text file
by Abigail-II (Bishop) on Aug 13, 2003 at 15:34 UTC | |
by hmerrill (Friar) on Aug 13, 2003 at 17:27 UTC | |
Re: Deleting a line out of text file
by pzbagel (Chaplain) on Aug 13, 2003 at 15:33 UTC | |
by Abigail-II (Bishop) on Aug 13, 2003 at 15:36 UTC | |
by crouchingpenguin (Priest) on Aug 14, 2003 at 02:38 UTC | |
by Anonymous Monk on Aug 13, 2003 at 17:11 UTC | |
by dga (Hermit) on Aug 13, 2003 at 17:35 UTC | |
by kesterkester (Hermit) on Aug 13, 2003 at 19:03 UTC | |
by Anonymous Monk on Aug 13, 2003 at 17:53 UTC | |
by dga (Hermit) on Aug 13, 2003 at 21:24 UTC |