in reply to Do regex using hash keys to wrapped template tokens
#!/usr/local/bin/perl -w use strict; use diagnostics; $|++; my $string = 'test $token1$ $lc_token1$ $token2$ $lc_token2$ end_test' +; my $w = '$'; my $token; for( qw/ token1 token2 / ) { $token = quotemeta $w . $_ . $w; $string =~ s/$token/replace1/g; $token = quotemeta $w . 'lc_' . $_ . $w; $string =~ s/$token/replace2/g; } print $string, "\n";
~Particle
|
|---|