my $char = "C"; my $pat = "[^$char]*$char" x $n; my $where; /^($pat)/ and $where = length $1 - 1;