in reply to Re^2: Interpolation of capture buffers not working when regex stored in variable
in thread Interpolation of capture buffers not working when regex stored in variable

Here's the modified code for others reference:
use String::Interpolate qw( interpolate ); ...[snip]... # Method 4: worked! (not global) #my ($before, $after) = $regex =~ m{/(.*)/(.*)/}; #$filename = replace($filename, $before, sub {interpolate($after)},0); # Method 5: worked! (global) my ($before, $after) = $regex =~ m{/(.*)/(.*)/}; $filename = replace($filename, $before, sub {interpolate($after)},1);
  • Comment on Re^3: Interpolation of capture buffers not working when regex stored in variable
  • Download Code