use Modern::Perl; my $string = 'Search, find and tell me! where, oh where are those funny characters???'; my @positions; push @positions, [$1, pos($string)] while ($string =~ m/([-\s,.!?;])/g); }