I've been able to read and output the external file containing the file 
listing. 

I've been told to do a "foreach" Would this go after the "while" or in place of?


open READFILE, "< file.in" or die qq(Cannot open file "file.in": $!);
while ($line = <READFILE>) {
                print $line;
        }
}
close (READFILE);



Things have kinda changed in the last few days in the way I need to do my 
script. Previsouly I was reading in an external file. Checking for a certain 
match and then 
replacing some text while at the same time writing the results out to a 
temoporary file. This all works great but I have to do another approach.

How would I do the following:

Read an external file which has a list of other external files listed within. 
Like this.

external file contents
-------------------------

S: 1 F: file1.txt
S: 2 F: file2.txt
S: 3 F: file3.txt
S: 4 F: file4.txt
S: 5 F: file5.txt

Then I need to open each file from the list one at a time and check for a 
certain string match. If found, do a search and replace and write the results 
out to a temoporary file 
(file1.tmp). Then rename that file back to the original (file1.txt). Then 
continue to the next line until the end has been reached.

I can't figure out the logic for this. Can you help?

Thanks







-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to