my $count = 0; my $N = 7; # Example. my $new_word = "new word"; s/(\w+)/++ $count == $N ? $new_word : $1/ge;
Untested though.
Abigail
In reply to Re: need help: substitute n-th word in a line
by Abigail-II
in thread need help: substitute n-th word in a line
by star7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |