From: Ian Jackson Date: Sun, 16 Feb 2020 20:45:18 +0000 (+0000) Subject: quacks-ingredients: counts wip X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d910b7d3abbea759a9d567d5c0ab0d1482ceac7d;p=reprap-play.git quacks-ingredients: counts wip Signed-off-by: Ian Jackson --- diff --git a/quacks-ingredients-counts.pl b/quacks-ingredients-counts.pl new file mode 100755 index 0000000..0affe2e --- /dev/null +++ b/quacks-ingredients-counts.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl -w + +use Data::Dumper; + +$_=; chomp or die; +our @names = split /\t/, $_; + +our %count; + +foreach my $nspots (qw(1 2 3 4)) { + $_=; 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