On Aug 9, 11:12 am, [EMAIL PROTECTED] wrote: > I am trying to replace a string within a bunch of html files.
.... so why does your subject say CSV? > Ideally, I would like to have the file name pulled from a list in a > text file, open the file, search for the string that will be replaced > within the file, pull the replacement string from another file, then > replace the string, close the file and move on to the next one. > > Does anyone know of a good place to find an existing script I can > modify for my purposes? This is fairly trivial. What part of it is giving you a problem? [untested] #!/usr/bin/perl use strict; use warnings; open my $rep_fh, '<', 'replacement.txt' or die $!; chomp (my $repl = <$rep_fh>); close $rep_fh; open my $file_fh, '<', "file_list.txt" or die $!; while (my $filename = <$file_fh>) { chomp $filename; open my $fh, '<', $filename or die $!; open my $ofh, '>', "$filename.mod" or die $!; while (<$fh>) { s/string_to_replace/$repl/g; print $ofh $_; } close $fh; close $ofh; } close $file_fh; __END__ Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/