Nansh has asked for the wisdom of the Perl Monks concerning the following question:
I am not able to do looping with two arrays simultaneously
I need to match the each elements from the below array
This should be done without using any modules
Eg: Array 1: A T C G T C G A G C G
Array 2: A C G T C C T G T C G
my ($array1ref, $array2ref) = @_; my @array1 = @$array1ref; my @array2= @$array2ref; my $count = 0; foreach my $element (@array1) { foreach my $element2 (@array2) { if ($element eq $element2) { $count++; }else { ??????????? }
Thank you
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Array looping
by johngg (Canon) on Apr 12, 2017 at 10:12 UTC | |
by vrk (Chaplain) on Apr 12, 2017 at 15:01 UTC | |
by johngg (Canon) on Apr 12, 2017 at 16:53 UTC | |
by vrk (Chaplain) on Apr 13, 2017 at 08:11 UTC | |
by Anonymous Monk on Apr 12, 2017 at 22:42 UTC | |
by vrk (Chaplain) on Apr 13, 2017 at 08:12 UTC | |
by james28909 (Deacon) on Apr 13, 2017 at 11:55 UTC | |
by afoken (Chancellor) on Apr 13, 2017 at 14:16 UTC | |
Re: Array looping
by choroba (Cardinal) on Apr 12, 2017 at 08:10 UTC | |
Re: Array looping
by kcott (Archbishop) on Apr 12, 2017 at 13:08 UTC | |
Re: Array looping
by Discipulus (Canon) on Apr 12, 2017 at 08:08 UTC | |
Re: Array looping
by Laurent_R (Canon) on Apr 12, 2017 at 08:53 UTC | |
by Anonymous Monk on Apr 12, 2017 at 17:36 UTC |