in reply to Replacing a specfied instance of a pattern in a string
my $instance = 3; $string = s/fsih/--$instance?$&:'fish'/eg; [download]