Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How can I increment a var in a substitution?

by suaveant (Parson)
on Aug 09, 2001 at 23:11 UTC ( #103573=note: print w/replies, xml ) Need Help??


in reply to How can I increment a var in a substitution?

the e modifier means evaluate right side of substitution as perl code... so you need /'<<TOKEN_'.$n++.'>>'/ to make it into perl code that makes the string you want to substitute... you could also do...
$html_file_slurped_to_a_scalar =~ s/<img .*?>/«TOKEN_${\($n++)}»/gis;
which is a little trick to put code into an interpolated string

                - Ant
                - Some of my best work - Fish Dinner

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://103573]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-01-23 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?