Palindrome pairs: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: Add a Perl 6 example)
m (→‎{{header|Perl 6}}: Slightly better palindrome detection. Ignore, case, punctuation and white-space. Same output)
Line 18: Line 18:
<lang perl6>my @words = <abcd dcba lls s sssll>;
<lang perl6>my @words = <abcd dcba lls s sssll>;


sub is-palindrome (Str $s) { $s eq $s.flip }
sub is-palindrome (Str $s) { $_ eq .flip given $s.lc.comb(/\w/).join }


for @words.combinations(2) {
for @words.combinations(2) {