Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a script to display mirror image of a entered value
and also check whether Palindrome

Answer Posted / guest

# Reverse a string and check if it is palindrome

my $str = "A man, a plan, a cat, a canal – Panama!"; # a
multiple word string

@arr = split //, $str;
my $revstr;
for (0..$#arr) {
$revstr .= join (//, pop(@arr));
}
print "reversed string: $revstr\n";

my $mod_str = $str;
$mod_str =~ (s/[\W]//g);
$revstr =~ (s/[\W]//g);

print "$str is a palindrome \n" if ( lc($mod_str) eq lc
($revstr) );

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain string comparison operators in perl.

1014


Explain the arguments for perl interpreter.

1256


Explain gmtime() function in perl?

981


What does undef function in perl?

953


How to connect to SQL server through Perl?

1058


Explain subroutine in perl?

956


How can you call a subroutine and identify a subroutine?

987


What are prefix dereferencer?

925


How do I replace every character in a file with a comma?

991


List the data types that Perl can handle?

1067


Explain lists and ivalue?

957


How do find the length of an array?

1136


In Perl we can show the warnings using some options in order to reduce or avoid the errors. What are that options?

1009


What is perl I used for?

963


How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.

2232