Help for this page
%d = ( foo => sub { "[@_]"; }, ... $_ = 'foo fooz bar baz1'; s/(\w+)(?(?{ !$d{$1} })(?!))/$d{$1}->($1)/ge; print "$_\n";
[foo] [foo]z (bar) baz1
s/ (\w+) # One or more word chars in capture buffer 1. Got it. ... # 3. (?!) says to *not* match a "1" followed by null. Maybe? # 4. (?...) means use the 1 not followed by null as a regexp modifier # to 'foo'? What?!