in reply to Regular expression question
But for a general case, it would be something like this (the sort is to prevent short matches like f from usurping longer ones like foo)
Update: Shamelessly stole Abigail's initialization syntaxmy %repls = qw( < < > > foo bar bar foo f baz ); my $replstr = join '|', sort {length $b <=> length $a} keys %repls; s/$replstr/$repls{$&}/g;
|
|---|