Help for this page
# Appends to the 3rd occurence of 'abc' from start-of-line ($a = $ref) =~ s/^(?:.*?abc\K){3}/___/; ... # omit ^ to append to every 1st occurence of 'abc' ($a = $ref) =~ s/(?:.*?abc\K){1}/___/g; print $a;