Rather than walking the arrays, use join and xor the joined strings, counting nuls with tr.
johngg@shiraz:~/perl/Monks > perl -Mstrict -Mwarnings -E ' my @arr1 = qw{ A T C G T C G A G C G }; my @arr2 = qw{ A C G T C C T G T C G }; my $count = ( ( join q{}, @arr1 ) ^ ( join q{}, @arr2 ) ) =~ tr{\0}{}; say $count;' 4
I hope this is of interest.
Cheers,
JohnGG
In reply to Re: Array looping
by johngg
in thread Array looping
by Nansh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |