no warnings 'uninitialized'; my $count = $text =~ s/(\([a-z]*\))(?:\s|_|$)/$1$2/gi; print $count; use warnings;