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