Hi guys this is my try.
use strict; use warnings; sub palindrome{ my ($n)=shift; my ($a,$b); $b=$a=$n; return $a if ($a eq reverse $a); 1 while (++$a != (reverse $a)); 1 while (--$b != (reverse $b)); (abs($n-$a)>abs($n-$b))?$b:$a; }
Please give your kind suggestions.
Murugesan.
In reply to Re: Challenge: Nearest Palindromic Number
by murugu
in thread Challenge: Nearest Palindromic Number
by Limbic~Region
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |