Help for this page

Select Code to Download


  1. or download this
    sub is_suffix { substr($_[0], -length($_[1])) eq $_[1] }
    
    ...
        $_[0] =~ m[(?>(.+))(?(?{ not is_suffix($_[1], $^N) })(?!))]s;
        return $1;
    }
    
  2. or download this
    use List::Util qw/ reduce /;
    
    ...
    
    __END__
    all
    
  3. or download this
    sub common_suffix {
        $_[0] =~ m[
    ...
        ]xs;
        return $1;
    }