Skip to content

Commit f417067

Browse files
namhsuyat2013anurag
authored andcommitted
Add is_palindrome.pl (#730)
* Add is_palindrome.pl Added Perl-script to find if a string is palindromic or not. * delete is_palindrome.pl adding subfolder * add perl folder, create is_palindrome.pl Perl-script for checking palindrome
1 parent cda17c7 commit f417067

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/perl -w
2+
3+
my $str;
4+
print "Enter a number/string to check if it's palindromic in nature: ";
5+
chomp ($str = <STDIN>);
6+
7+
my $revStr = reverse $str;
8+
9+
if(uc($revStr) ne uc($str)){
10+
print "Not palindromic";
11+
}
12+
else{
13+
print "Palindromic";
14+
}

0 commit comments

Comments
 (0)