<commit_before>use strict;
use warnings;
use Time::HiRes qw( clock );


sub permute
{
    my @arr = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    for my $perm (1..999999) {
        my $len = scalar(@arr);
        my $i = $len - 2;
        my ($l1, $l2);
        my $f = "";
        for (; $i >= 0; $i--) {
            if ($arr[$i] lt $arr[$i + 1]) {
                $l1 = $i;
                $f = $arr[$i];
                last;
            }
        }   
        my $low = "";      
        for (; $i <= $len - 1; $i++) {
            if ($arr[$i] gt $f) {
                if ($low eq "") {
                    $l2 = $i;
                    $low = $arr[$i];
                } elsif ($low gt $arr[$i]) {
                    $l2 = $i;
                    $low = $arr[$i];
                }
            }
        }
        my $temp = $arr[$l2];
        $arr[$l2] = $arr[$l1];
        $arr[$l1] = $temp;
        if (!($l1 >= $len - 1)) {
            @arr = (@arr[0..$l1], sort(@arr[$l1 + 1..$len - 1]));<commit_msg>declare vars outside of loop<commit_after>use strict;
use warnings;
use Time::HiRes qw( clock );


sub permute
{
    my @arr = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    my $len = scalar(@arr);
    my ($l1, $l2);
    my $f = "";
    for my $perm (1..999999) {
        my $i = $len - 2;
        for (; $i >= 0; $i--) {
            if ($arr[$i] lt $arr[$i + 1]) {
                $l1 = $i;
                $f = $arr[$i];
                last;
            }
        }   
        my $low = "";      
        for (; $i <= $len - 1; $i++) {
            if ($arr[$i] gt $f) {
                if ($low eq "") {
                    $l2 = $i;
                    $low = $arr[$i];
                } elsif ($low gt $arr[$i]) {
                    $l2 = $i;
                    $low = $arr[$i];
                }
            }
        }
        my $temp = $arr[$l2];
        $arr[$l2] = $arr[$l1];
        $arr[$l1] = $temp;
        if (!($l1 >= $len - 1)) {
            @arr = (@arr[0..$l1], sort(@arr[$l1 + 1..$len - 1]));
{'fraction_non_alphanumeric': 0.22885085574572128, 'fraction_numerical': 0.036185819070904644, 'mean_word_length': 1.0237388724035608, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2209199', 'n_tokens_mistral': 796, 'n_tokens_neox': 748, 'n_words': 191}