in reply to recursive s///g core dumps
#!/usr/bin/perl -w use strict; my $weeping; print doFunc( "AABBCC",0 ); print doFunc( "AAAABBBBCCCC",0 ); sub doFunc { my( $theParam,$depth) = @_; print STDERR "\ndofunc($theParam)\n"; my $re; $re = ${['(.+)$weeping']}[$depth]||'(.+)($weeping)'; print STDERR join"\n", $theParam =~ /$re/g,undef; $theParam =~ s/$re/&doFunc($weeping,$depth+1)/ge; $weeping=$1; ++$theParam; print STDERR "=$theParam\n"; return $theParam; }
dofunc(AABBCC) =AABBCD AABBCD dofunc(AAAABBBBCCCC) =AAAABBBBCCCD AAAABBBBCCCD
|
|---|