AI, Computational Biology, Population Genetics
Wednesday, October 22, 2014
count redundant values in a array
my @array = qw(foo bar foo bar baz foo baz bar foo);
my %counts = ();
for (@array) {
$counts{$_}++;
}
foreach my $keys (keys %counts) {
print "$keys = $counts{$keys}\n";
}
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment