kingman has asked for the wisdom of the Perl Monks concerning the following question:
This turns all img links into «TOKEN_0++»; $n interpolotes but doesn't increment.$n = 0; $html_file_slurped_to_a_scalar =~ s/<img .*?>/«TOKEN_$n++»/gis;
Maybe I'm trying to do too much but I'd like to avoid the following loop if I can:Unrecognized character \xAB at /path/foo line 25.
evaluate $html_file_slurped_to_a_scalar
change the first image tag to «TOKEN_$n»
increment $n
Any suggestions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How can I increment a var in a substitution?
by suaveant (Parson) on Aug 09, 2001 at 23:11 UTC |