$ perl -lwe ' $string = q; $string =~ s: /\* (.*?) \*/ : (my $x = $1) =~ s/[^\n]//g; $x :gsex; print $string; ' ab