use strict; use warnings; print "Enter left side for search: "; my $LeftSide = ; print "Enter right side replacement: "; my $RightSide = ; chomp($LeftSide); chomp($RightSide); while(){ print if s/$LeftSide/$RightSide/g; #print "Replaced \"$LeftSide\" with \"$RightSide\" at: line $.: $_" if ($_ =~ s/$LeftSide/$RightSide/g); } __DATA__ hello this. is line 2 line, 3 ),( this is test for line 4 ) testing line ,5 now testing line (6) #### C:\Users\James\Desktop>test.pl \),\( \)\n\( Replaced "\),\(" with "\)\n\(" at: line 3 "line, 3 \)\n\("