in reply to modifying en passant

The solution is to copy the captures earlier. One way:

if ( my ($new1, $new2, $new3) = $string =~ /(p1)(p2)(p3)/ ) { $new1 =~ s/this/that/; $new2 =~ s/this2/that2/; $new3 =~ s/this3/that3/; ... }

Bonus: No global vars!

Replies are listed 'Best First'.
Re^2: modifying en passant
by lcschreier (Novice) on Jan 10, 2010 at 23:03 UTC

    that's a very nice way to do what I intended. hadn't occurred to me to do it that way, but now that I know, I'll use it. thanks