in reply to nested replace
generic "pattern" hahyaha
$var =~ s{(yada)}{OtherSubstitute("$1")}ge; sub OtherSubstitute { my( $in ) = @_; ## $in =~ s{yada}{yada}g; my $numlines = $in =~ tr/\n/\n/; ## count return "\n" x $numlines; } [download]