my $hyphens = 0; $hyphens++ while $str =~ /-/g;