# Global mode (pretty slow on large files) $_=q qrea ncJertsa ,thelhPkour q,my $i=length; while($i){s/(.{$i})(.)/$2$1/g;--$i}print+$_.$/ #### # Non-global $_=q qnPteorJlt hhascekaerru, q,my $i=length; while($i){s/(.{$i})(.)/$2$1/;--$i}print+$_.$/; #### # Opposite code: $_=q qJust another Perl hacker,q;until($i eq length){s/(.)(.{$i})/$2$1/g;++$i}print+$_.$/