http://qs1969.pair.com?node_id=1187743


in reply to Array looping

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