#!/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 = "cooc"; my $is_palindrome = ($word eq reverse($word)); print $is_palindrome;