in reply to within pattern manipulation

$sentence =~ s{ ( $phrases ) }{ ( my $string = $1 ) =~ tr/ /_/; "%$str +ing%" }xieg;

Replies are listed 'Best First'.
Re^2: within pattern manipulation
by newbio (Beadle) on Sep 18, 2009 at 14:21 UTC
    Thanks jwkrahn for the reply. However, it is not producing the desired output. The output I am getting is:

    A and B %regulate% each other in cells

      By using "x", he changed the meaning of the spaces in your pattern. Fixed:
      $sentence =~ s{($phrases)}{ ( my $string = $1 ) =~ tr/ /_/; "%$string%" }ieg;
        Very nice. Thank you.