my $count = 1; my $str = "a,b,c,d"; $str =~ s/((,.*?){$count}),/$1|/; print $str; [download]
In reply to Re: Replace the nth occurence by grizzley in thread Replace the nth occurence by Anonymous Monk