Another alternative:
use Regexp::Common 'comment'; $str=~s/($RE{comment}{C})/($a=$1)=~s#[^\n]##g;$a/ge; [download]
In reply to Re: nested replace by Anonymous Monk in thread nested replace by Anonymous Monk