$VAR1 = {
'A2M' => [
'C972Y',
'A423W'
],
'A4GALT' => [
'W261X',
'P251L',
'P251S',
'A219V'
]
};
####
gene total x
A2M 2 0
A4GALT 4 1
####
my %hash;
while()
{
chomp;
my $line = $_;
my ($key, @val) = split /\t/, $line, 2;
push @{ $hash{$key} }, @val;
}
####
my $totalcount = 0;
my $xcount = 0;
foreach my $k (sort keys %hash)
{
print "Current key is\t" . $k . "\n";
my @values = $hash{$k};
foreach $i (@values){
$xcount++ if $i =~ /(X)/;
$totalcount++;
}
print $k . "\t" . $totalcount . "\t" . $xcount . "\n";