Help for this page

Select Code to Download


  1. or download this
    sub foo { (my $text = $_[0]) =~ s/$_[1]/$_[2]->($1)/e;
              print $text; }
    
    foo("This is test 1\n", qr/test (.*)/, sub{"fish $_[0]"});
    
  2. or download this
    sub foo { (my $text = $_[0]) =~ s/$_[1]/$_[2]->()/e;
              print $text; }
    
    foo("This is test 1\n", qr/test (.*)/, sub{"fish $1"});