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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2016-02-09 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (316 votes), past polls