lampros21_7 has asked for the wisdom of the Perl Monks concerning the following question:
My query is quite different but still am sure it can be done with Perl although i don't know how
I have an array of all the bigrams that exist in the alphabet. A bigram is a two - letter combination.
I have all the bigram combinations in an array so $bigram[0] is aa and $bigram[675] is zz.
$bigram[0] = "aa"; $bigram[1] = "ab"; ...$bigram[675] = "zz"
Now i have an array that contains a bigram for every element. From that array i want to check which bigrams from my list exist in my @bigram_list array. For those bigrams that indeed exist once or more i want to make another array the same size as my @bigram array that will have a 1 for those bigrams that exist and a 0 for the bigrams that don't exist in my @bigram_list array.
For example:
@bigrams : as said previously
@bigram_list = ("ac","ab","wd","xs");
So here, the new array that i want to hold the numbers will have 0 in every element apart from the positions where "ac", "ab", "wd" and "xs" are where there should be a 1.
Sorry, if this is complicated i tried to make it as understandable as i could. Does anyone know of a way i could do this? Thanks for looking
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Identifying bigrams and making a note of which ones exist
by jdporter (Paladin) on Mar 10, 2006 at 20:41 UTC | |
by GrandFather (Saint) on Mar 10, 2006 at 21:06 UTC | |
|
Re: Identifying bigrams and making a note of which ones exist
by roboslug (Sexton) on Mar 11, 2006 at 03:09 UTC | |
|
Re: Identifying bigrams and making a note of which ones exist
by planetscape (Chancellor) on Mar 11, 2006 at 12:53 UTC | |
|
Re: Identifying bigrams and making a note of which ones exist
by Lu. (Hermit) on Mar 11, 2006 at 13:19 UTC | |
|
Re: Identifying bigrams and making a note of which ones exist
by ff (Hermit) on Mar 12, 2006 at 05:14 UTC |