Help for this page

Select Code to Download


  1. or download this
    %d = (
        foo => sub { "[@_]"; },
    ...
    $_ = 'foo fooz bar baz1';
    s/(\w+)(?(?{ !$d{$1} })(?!))/$d{$1}->($1)/ge;
    print "$_\n";
    
  2. or download this
    [foo] [foo]z (bar) baz1
    
  3. or download this
    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?!