print "Search REGEX: "; chop($search = ); print "Replace with: "; chop($replace = ); $text =~ m/($search)/; $test = $1; print "\n\nWith the given pattern, the first string found was:\n$test\n\n"; $test =~ s/$search/$replace/m; print "Which was evaluated to:\n$test\n\n"; print "Continue (y/n)?: "; chop($cont = ); if ($cont eq 'y' || $cont eq 'Y'){ $num = $text =~ s/$search/$replace/mg; open (OUT, "> $file.out"); print OUT $text; close (OUT); print "\n\n Successfully replaced $num occurances.\n"; } else { print "Aborted.\n"; }