Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Double interpolation of captured substrings

by bobf (Monsignor)
on Nov 17, 2004 at 09:37 UTC ( #408346=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $newstring = munge_string( 'one_two_three', '312' );
    
    ...
    
        return $patterns{$patternkey}; # want 'threeonetwo', got '$3$1$2'
    }
    
  2. or download this
    $string =~ s/(\w+)_(\w+)_(\w+)/$patterns{$patternkey}/e;
    print $string; # '$3$1$2'
    
  3. or download this
    $string =~ s/(\w+)_(\w+)_(\w+)/$3$1$2/;
    print $string; # 'threeonetwo'
    
  4. or download this
    $string =~ s/(\w+)_(\w+)_(\w+)/join( '', $3, $1, $2 )/e;
    print $string; # 'threeonetwo'
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://408346]
Approved by Corion
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2016-12-05 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (84 votes). Check out past polls.