#!/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
