Help for this page

Select Code to Download


  1. or download this
    my $regex = ['(foo)',sub {\"bar$1"}];
    my $string = 'blah foo blah';
    $string =~ s/$regex->[0]/${(ref($regex->[1]) eq 'CODE' ? $regex->[1]->
    +() : \$regex->[1])}/;
    print "S=$string\n";