Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Sequential Replacement

by elusion (Curate)
on Jul 09, 2002 at 17:39 UTC ( [id://180551]=note: print w/replies, xml ) Need Help??


in reply to Sequential Replacement

Try using the //e modifier with the //g modifier. For instance:
my @array = (1, 2, 3, 4, 5, 6); my $string = "ababbabaaba"; $string =~ s/a/shift(@array)/ge; print $string; # prints "1b2bb3b45b6"
The //e modifier executes whatever is between the last to //'s as code.

elusion : http://matt.diephouse.com

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found