|
|
|
Your skill will accomplish what the force of many cannot |
|
| PerlMonks |
Double interpolation of captured substringsby bobf (Monsignor) |
| on Nov 17, 2004 at 09:37 UTC ( #408346=perlquestion: print w/ replies, xml ) | Need Help?? |
|
bobf has asked for the
wisdom of the Perl Monks concerning the following question:
Oh wise ones, I am trying to write a function that returns a string that is assembled from a regex, but the order that the captured substrings are assembled in is determined by one of the passed arguments. Here is an overly simplified example of what I'm trying to do: How can I get the function to return a double-interpolated value (once to get the hash value, then again to get the captured substrings)? I tried using eval (to no avail), and then s///e instead of m//, but I only got single interpolation: If I put the replacement pattern in directly, though, it works fine: or
Is there a way to do this cleanly, or am I going about this the wrong way? Thanks in advance.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||