http://www.perlmonks.org?node_id=647158


in reply to Can you assign to pos() in a s/foo/bar/g

Whats wrong with:

my $str=q{DFR7234C__A_B_C_Bonzo_Dog_D_B}; $str =~ s/(?<=__)([A-Z]_)+//g;

I'd guess, pos() is localized within the code assertion. Pos() would be changeable within the while loop triggered by the regex (1st example). Maybe one of the gods may bring some light into this.

BTW, oha presented already a very nice solution here.

Regards

<mwa