chiark / gitweb /
quacks-ingredients: counts wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Feb 2020 20:45:18 +0000 (20:45 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 16 Feb 2020 20:45:18 +0000 (20:45 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
quacks-ingredients-counts.pl [new file with mode: 0755]

diff --git a/quacks-ingredients-counts.pl b/quacks-ingredients-counts.pl
new file mode 100755 (executable)
index 0000000..0affe2e
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use Data::Dumper;
+
+$_=<DATA>; chomp or die;
+our @names = split /\t/, $_;
+
+our %count;
+
+foreach my $nspots (qw(1 2 3 4)) {
+    $_=<DATA>; chomp or die;
+    my @l = split /\t/, $_;
+    foreach my $i (0..$#names) { $count{$names[$i]}{$nspots} = $l[$i] // 0; }
+}
+
+$_ = Dumper(\%count);
+s{^}{// }mg;
+print or die $!;
+
+__DATA__
+White  Green   Blue    Red     Yellow  Purple  Black   Orange
+20     15      14      12      13      15      18      20
+8      10      10      8       6
+4
+       13      10      10      10