User Input: She sells Seashells by the seashore. Search Pattern: sea Replacement Pattern: bay Final Output: She sells bayshells by the bayshore. But what I want it to do is keep the capitalization. Final Output: She sells Bayshells by the bayshore. #### main(); sub main { print "Text to be analyzed.\n"; print "Type a blank line when finished.\n\n"; while (<>) { /^$/&& last; $input.=$_} chomp($input); replace (); $input = ""; again (); } sub replace { print "\nSearched for: "; $pattern = <>; chomp($pattern); print "\nReplace with: "; $replacement = <>; chomp($replacement); $input =~ s/$pattern/$replacement/ig; }