Hi I am new to this group and to Perl. I am having trouble with searching and replacing a pattern in a file and then copying to a new file. I am trying to write an interactive program to do this where I input the file name for the search and replace and the file name for the modified file to be saved.
Here is my code. Can anyone offer any suggestions? Thanks in advance. #!/usr/bin/perl -w use strict; my $input; my $output; my $search; my $replace; print "enter an input file name:\n"; $input = <STDIN>; chomp ($input); print "enter an output file name:\n"; $output = <STDIN>; chomp ($output); print "enter a search pattern:\n"; $search = <STDIN>; chomp ($search); print "enter a replacement string:\n"; $replace = <STDIN>; 's/$search/$replace/g' $input >> $output; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/