in reply to Identifying bigrams and making a note of which ones exist
use strict; use warnings; my @bg_data = qw( aa aa aa sd gd sd bf bf sd gd sd df sb eb xd bf dr et bf bf +sd bd aa aa aa ab ab ab ab ab ab ab ab ab sb eb ad ad ad ad ad bf +sd bd ); # Note and accumulate how many times each bigram is used.... my %bg_stats; $bg_stats{$_}++ foreach @bg_data; # Store the data in the 676-element array.... my @bg_final = map{ $bg_stats{$_} ||= 0 } ( 'aa' .. 'zz' ); #print "$_\n" foreach @bg_final;
|
|---|