Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi everybody. Being relatively new to perl is am still having problems applying what I know to my needs. How do I impose a condition in an if cicle for matching the first word of a string part of an @AoA data structure with the first word of a string in another array? My goal is then to add the second word of the first string to the second string. Thank you all very much in advance
my($other_array) = ''; foreach $other_array (@other_array){ foreach my$arr (@AoA){ foreach my$sca (@$arr){ $sca if (($sca =~ m/\w+/g)[0] eq ($uniq_kmers =~ m/\w+/g)[0]){ $uniq_kmers =~ "\t".($sca =~ m/\w+/g)[1]; }else{ $uniq_kmers =~ "\t0"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pattern matching from an array to an array of arrays
by Corion (Patriarch) on Oct 22, 2016 at 11:54 UTC | |
by Anonymous Monk on Oct 22, 2016 at 12:33 UTC | |
by Corion (Patriarch) on Oct 22, 2016 at 13:04 UTC | |
by Anonymous Monk on Oct 22, 2016 at 13:41 UTC | |
by AnomalousMonk (Archbishop) on Oct 22, 2016 at 15:17 UTC | |
by Corion (Patriarch) on Oct 22, 2016 at 13:48 UTC |