print "LOAD $keys_file", scalar keys %$keys, "\n";
}
-foreach my $nr ( 1 .. 4 ) {
- my $file = "$nr.csv";
+foreach my $val ( 1 .. 4 ) {
+ my $file = "$val.csv";
warn "# $file\n";
my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1 });
open my $fh, "<:encoding(utf8)", $file or die "$file: $!";
while (my $row = $csv->getline ($fh)) {
- $stat->{lines}->{$nr}++;
+ $stat->{lines}->{$val}++;
$stat->{ $file }->{lines}++;
- $row->[1] =~ s/\D+//g && $stat->{corrupt}->{skola}->{$nr}++ && print 'c1';
- $row->[2] =~ s/\D+//g && $stat->{corrupt}->{razred}->{$nr}++ && print 'c2';
+ $row->[1] =~ s/\D+//g && $stat->{corrupt}->{skola}->{$val}++ && print 'c1';
+ $row->[2] =~ s/\D+//g && $stat->{corrupt}->{razred}->{$val}++ && print 'c2';
my $id = join('-',
uc $row->[0],
$row->[1],
my $num = uc $row->[0];
if ( length $num < 3 ) {
- print "IGNORE $nr ",dump($row->[ 0 .. 5 ]),$/;
- $stat->{ignore}->{$nr}++;
+ print "IGNORE $val ",dump($row->[ 0 .. 5 ]),$/;
+ $stat->{ignore}->{$val}++;
next;
}
my $key_id = $row->[1] . '-' . $row->[2];
- $stat->{A_key_id}->{$key_id}->{$nr}++;
+ $stat->{A_key_id}->{$key_id}->{$val}++;
$keys->{ $key_id }->{ $num }++;
- $stat->{exists}->{$nr}++ if exists $stat->{_}->{ $id };
+ $stat->{exists}->{$val}++ if exists $stat->{_}->{ $id };
- push @{ $stat->{_}->{ $id } }, $nr;
+ push @{ $stat->{_}->{ $id } }, $val;
+
+ $data->{$key_id}->{$val}->
}
close $fh;