sub scramble { (my $str, my $toshuf) = @_; my $len = length($str); if($toshuf * 2 > $len){ return "!error-rorre!"; } $str = lc($str); my @idx = (); my $i = $toshuf; push(@idx, $i--) while $i; push(@idx, ($toshuf + 1) .. ($len - $toshuf)); push(@idx, $len - $i++) while $i < $toshuf; return sprintf(join("", map({"%$_\$s"} @idx)), split(//, $str)); }