in reply to perl: comparing words in the arrays

It would be better if @seq1 was an array of words, not an array with just a single element.

You can use an old trick: XOR the two strings and count the number of non-null characters:

#!/usr/bin/perl use strict; use warnings; my @seq1 = qw(ATGC TGCT GCTA CTAA TAAC); my $seq2 = 'GTCA'; for my $seq (@seq1) { my $count = ($seq ^ $seq2) =~ tr/\0//c; print "$seq $count\n"; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ