CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Deleting words from files

 



benchivers
Deleted

Feb 16, 2001, 10:57 AM

Post #1 of 2 (246 views)
Deleting words from files Can't Post

How can you search for a certain word in a text file and then delete that word from the text file. Help urgently needed! CHEERS!!



sleuth
Enthusiast / Moderator

Feb 16, 2001, 11:56 AM

Post #2 of 2 (245 views)
Re: Deleting words from files [In reply to] Can't Post

 
Individual words????

open(file, "<file.db");
while(<file>)
{
$_ =~ s!WORD! !gi;
$new_file .= "$_";
}
close(file);
open(data, ">file.db");
print data "$new_file";
close(data);

Help at all?

Tony


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives