my $string = "abba"; my $substr_count = $string =~ y/a/a/; #oder auch: my $substr_count_2 = @{[$string =~ m/(a)/g)]};