Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Perl 中,如何旋转整数位?这是示例输入和输出
12345 10901
51234 11090
$x = chop($x) . $x;
或者
$x = substr("$x$x",length($x)-1,length($x))
use warnings; use strict; for my $x (qw(12345 10901)) { my $r = substr($x, -1, 1) . substr($x, 0, -1); print "$r\n"; } __END__ 51234 11090