diff options
| -rw-r--r-- | challenge-118/vinod-k/perl/ch-1.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-118/vinod-k/perl/ch-1.pl b/challenge-118/vinod-k/perl/ch-1.pl new file mode 100644 index 0000000000..efb25316af --- /dev/null +++ b/challenge-118/vinod-k/perl/ch-1.pl @@ -0,0 +1,11 @@ +use strict; use warnings; + +my $N = $ARGV[0] || die "Please enter an integer"; + +my $N_Bin = sprintf ("%b", $N); + +if( $N_Bin eq reverse($N_Bin)){ + print "1 as binary representation of $N is $N_Bin which is Palindrome\n"; +} else { + print "0 as binary representation of $N is $N_Bin which is NOT Palindrome\n"; +} |
