Help for this page
my %lookup = ( bar => 'thing1', foo => 'thing2'); $_ = "this has bar and foo\n"; s/(bar|foo)/$lookup{$1}/g; print; #=> this has thing1 and thing2
sub foo { return reverse uc shift } $_ = "this has bar and foo\n"; s/(bar|foo)/foo($1)/eg; print; #=> this has RAB and OOF