fork download
  1. #!/usr/bin/perl
  2. use 5.016;
  3. use warnings;
  4.  
  5. foreach(qw(
  6. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  7. 123412312341231234123123412312341231234123
  8. oxoxoxoxoxoxoxoxxoxoxoxoxoxoxoxoxx
  9. )){
  10. say $_, " -> ", /^(.+?)\1*$/;
  11. }
  12.  
Success #stdin #stdout 0s 3692KB
stdin
Standard input is empty
stdout
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -> a
123412312341231234123123412312341231234123 -> 1234123
oxoxoxoxoxoxoxoxxoxoxoxoxoxoxoxoxx -> oxoxoxoxoxoxoxoxx