Help for this page

Select Code to Download


  1. or download this
    my $regex = ['(foo)','bar'];
    $string =~ s/$regex->[0]/$regex->[1]$1/;
    
  2. or download this
    #!/usr/bin/perl
    use strict;
    ...
    my $string = 'blah foo blah';
    $string =~ s/$regex->[0]/$regex->[1]/ee;
    print "$string\n";