#!/usr/local/bin/perl use strict; use warnings; my $string = ' Yoda said, "can you see this?" '; #my @allwords = split(" ", $string); #my $revwords = join(" ", reverse @allwords); #my $revwords = join(" ", reverse split(" ", $string)); my $revwords = join(" ", reverse split(/(\s+)/, $string)); print $revwords, "\n"; my $word = "reviver"; my $is_palindrome = ($word eq reverse($word)); print $is_palindrome; perl -nle 'print if $_ eq reverse && length > 5' /usr/dict/words