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