0 Replies - 1346 Views - Last Post: 19 October 2007 - 08:37 AM

#1 girasquid   User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Palindrome Checking

Posted 19 October 2007 - 08:37 AM

Description: Just call the function checkPalindrome("yourword");, and it will return 1 or 0 based on whether the word is a palindrome or not. It works for words and numbers.Want to check if something is a palindrome? Use this function.
sub palindrome_check {
	my $p = shift;
	if($p eq reverse $p) {
		return 1;
	} else {
		return 0;
	}
}

Is This A Good Question/Topic? 0
  • +

Page 1 of 1