use strict; use warnings; use 5.010; use Regexp::Common 'RE_balanced'; my $string = 'The use of parentheses (indicates that the ' . '(writer [considered] the {information}) less ' . ' an afterthought).'; my $match = RE_balanced( -parens => '(){}[]<>' ); $string =~ s/${match}.*//; $1 and say ">$_<" for $string, $1; #### $ perl 11114819.pl >The use of parentheses < >(indicates that the (writer [considered] the {information}) less an afterthought)<