changeset 135:88cf0ca0f137 misc

Use strict;
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 20 Dec 2010 16:27:11 +0000
parents b2685ec16e67
children 9a0e08516041
files materials/csv2transtab.pl
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/materials/csv2transtab.pl	Mon Dec 20 15:41:27 2010 +0000
+++ b/materials/csv2transtab.pl	Mon Dec 20 16:27:11 2010 +0000
@@ -7,22 +7,24 @@
 # The generated table needs to be manually sorted in "sane" way,
 # the different adjectives cannot be heuristically sorted here.
 #
-#use strict;
+use strict;
 
 my %data = ();
+
 while (<STDIN>) {
   chomp;
-  if (/^([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z -]+);([a-z ]+);([a-zA-Z ]+);(Yes|No);([A-Z][a-z]+);([a-z, ]+);([a-z, ]+);$/) {
-    for (my $i = 2; $i <= 18; $i++) {
-      $data{$i}{$$i}=1;
+  if (my @tmp = /^([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z -]+);([a-z ]+);([a-zA-Z ]+);(Yes|No);([A-Z][a-z]+);([a-z, ]+);([a-z, ]+);$/) {
+    my $n = 2;
+    for (my $i = 1; $i <= 17; $i++, $n++) {
+      $data{$n}{$tmp[$i]}=1;
     }
-    for (my $i = 19; $i <= 20; $i++) {
-      foreach my $t (split(/, */, $$i)) {
-        $data{$i}{$t}=1;
+    for (my $i = 18; $i <= 19; $i++, $n++) {
+      foreach my $t (split(/, */, $tmp[$i])) {
+        $data{$n}{$t} = 1;
       }
     }
   } else {
-    print STDERR "# $_\n";
+    print STDERR "$0: ERROR: $_\n";
   }
 }