Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Regular expression "replace string interpolation" problem

by pc88mxer (Vicar)
on May 16, 2008 at 22:21 UTC ( #687035=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    ...
    my $replace = '"$1 Perl"';
    
    $text2 =~ s/$match/$replace/ee;
    
  2. or download this
    my $replace = '$1 Perl'; # use original setting of $replace
    
    $text2 =~ s/$match/'"'.$replace.'"'/ee;
    
  3. or download this
    
    my $replace = sub { "$1 Perl" };
    
    $text2 =~ s/$match/$replace->()/e;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://687035]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-08-28 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (255 votes), past polls