Help for this page

Select Code to Download


  1. or download this
    my @strs = qw/fooxx baryyyy bazzzzzzz/;
    s{ ( (.) \2+ ) \z }(substr($1, 0, length($1) / 2))ex, print
    ...
    foox
    baryy
    bazaaa
    
  2. or download this
    reverse =~ /\A((.)\2+)/ and substr($_, -(length($1) / 2)) = ''
      for @strs;
    ...
    foox
    baryy
    bazaaa