How about if we just drop all the words in (parens) and display what's left? #!/usr/bin/perl use strict; use warnings; my(@a,@b,$i,$j,$k,$s,$t); my(@out,$ins,$outs); $ins="clicking the (Run Match) button (or F5) to see what (happens). "; print "\n"; $outs=$ins; $outs=~s/\(.+?\)//g; $outs=undupespace($outs); print "$outs\n"; exit; # Exit main pgm. ################################################################### sub undupespace # Remove dupe spaces. Max 1 consecutive space. {my($l)=@_; $l=~s/ {2,}/ /g; return $l; # undupespace } Output: clicking the button to see what .