in reply to Re: Search and replace
in thread Search and replace

I am having a hard time getting this started.

To explain further what I want to do, I currently have 1 file with a list of email addresses. These I am trying to use as my variables. I have another text file where I need to search for "email=john.edu" and replace with email=new_address.edu. Then I would like to save this file with the changes as new_address.txt. I have 100 email addresses in my list. I would like this process to repeat until the end of the adresses. I should have 100 new text files in this directory.

I am new to perl and really do not know where to start. I don't know how to read in my email list and search to replace just the new email address and save the entire file before continuing with the loop.

open (FILEHANDLE, "<$john.txt"); #open main file open (DATA, "<email_list.txt"); @lines = <DATA>; $/ = "\"; while (<DATA>) { #PROCESS AND UPDATE A RECORD }
If you can think of a better way to do this, please let me know. Thanks!!!!