From 791e651e5a51ff0bc2e1e24eba09106b692f7a54 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 22 Nov 2023 09:36:03 +0100 Subject: [PATCH] val --- upari.pl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/upari.pl b/upari.pl index cbb178f..1755230 100755 --- a/upari.pl +++ b/upari.pl @@ -82,17 +82,17 @@ if ( -e $keys_file ) { 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], @@ -101,20 +101,22 @@ foreach my $nr ( 1 .. 4 ) { 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; -- 2.20.1