my $regex = join "|", map quotemeta, keys %substitute_hash; $regex = qr/$regex/; # compile ... $string =~ s/($regex)/$substitute_hash{$1}/g;
-- Randal L. Schwartz, Perl hacker
In reply to Re: hashes in regexes
by merlyn
in thread hashes in regexes
by DeusVult
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |