Search code examples
perlinteger

Rotating digits of an integer


How do I rotate the digits of integer? Here are sample inputs and Outputs:

Sample Input

12345 10901

Sample Output

51234 11090


Solution

  • $x = chop($x) . $x;
    

    or

    $x = substr("$x$x",length($x)-1,length($x))