in reply to hashes in regexes
my $regex = join "|", map quotemeta, keys %substitute_hash; $regex = qr/$regex/; # compile ... $string =~ s/($regex)/$substitute_hash{$1}/g;
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: hashes in regexes
by tilly (Archbishop) on Mar 29, 2001 at 19:32 UTC |