Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Double interpolation of captured substrings

by Arunbear (Prior)
on Nov 17, 2004 at 10:05 UTC ( [id://408353] : note . print w/replies, xml ) Need Help??


in reply to Double interpolation of captured substrings

Use array slicing:
my %patterns = ( 123 => [0,1,2], 312 => [2,1,0] ); my @matches = $string =~ m/$some_pattern/; return join '', @matches[@{$patterns{$patternkey}}];