Help for this page

Select Code to Download


  1. or download this
    my $re;
    $re = qr/((.)(??{ $re })\2|.)/;
    ...
        local $\ = "\n";  # add newline to print
        substr($s, $i) =~ /^$re/ and print $1;
    }
    
  2. or download this
    my $s = 'abcdegedfc';
    foreach my $i (0 .. length($s) - 1) {
    ...
        substr($s, $i) =~ /((.*).?(??{ quotemeta reverse $2 }))/
          and print $1;
    }