#!usr/bin/perl use strict; my $in_file; my $out_file; my $answer; my $pattern; my $replacement; # This program prompts user for an input file, an output file, a search pattern and a replacement string, then executes the search and replacement between the two files. print "Enter the in_put file"; chomp($in_file = ); print "Enter the out_put file"; chomp($out_file = ); print "Enter the pattern"; chomp($pattern = ); print "Enter the replacement"; chomp($replacement = ); open (IN, "$in_file") || die "not a rockstar today"; die "will not overwrite $out_file" if -e $out_file; open (OUT, ">$out_file") || die "not a rockstar today"; while () { # S/$pattern/$replacement/g; print OUT $_; } # end while close (IN); close (OUT);