my $palindrome_re = qr{ \b (? # A palindrome is a sandwich... (?\w) # starting with white bread... (?: # filled with either... \w? # peanut butter (maybe)... | # or... (?&pal) # another sandwich... ) \k # topped off with white bread! ) \b }x; @ARGV = 'words'; /$palindrome_re/ and print while <>;