my $str = 'one a two a three a four'; my $char = 'a'; my $n = 2; $str =~ /(?:.*?$char){$n}/g; print "Pos of '$char' #$n in '$str' is ", pos($str), "\n";