in reply to RE: RE: RE: Selective substitution: not in Perl?
in thread Selective substitution: not in Perl?

You're absolutely right, of course. Now I remember why I didn't post that solution in the first place :(

Update:

On thinking about it further, I realise that:

$string =~ s/^(($pattern.*?){$n})$pattern/$1$better/;

will probably do the trick.

--
<http://www.dave.org.uk>

European Perl Conference - Sept 22/24 2000, ICA, London
<http://www.yapc.org/Europe/>