in reply to Creating hash: Key is unique string in array element, value is number of times it appears
prints...use warnings; use strict; use Data::Dumper; my %genus; while ( my $line = <DATA> ) { chomp $line; next if $line =~ /Query=/; my @hit = split( /\s/, $line ); $genus{ $hit[2] }++; } print Dumper(\%genus); __DATA__ Query= 16sV5:44:FC62N5DAAXX:7:1:18808:1248 1:N:0: 1111599 AB563244.1 Streptococcus macedonicus str. W28 1111215 AB563262.1 Streptococcus equinus str. MTS6
$VAR1 = { 'Streptococcus' => 2 };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Creating hash: Key is unique string in array element, value is number of times it appears
by putmant (Initiate) on Oct 26, 2011 at 17:26 UTC |