in reply to match n EMth/EM occurence

This isn't pure regex, but it is the way I would have solved the problem. If matches $char, assigns the prematch to $match, and when the counter == $n it exits and prints $match. Kinda ugly, but works well!
$n = 5; $char = 'l'; $string = 'hello my name is william gobbel-dy-gook liam'; $count = 0; while ($string =~ /[$char]/g) { $match = $`; $count++; last if $count == $n; } print $match;