#usr/bin/perl use strict; use warnings; use Bio::SeqIO; # 'shift' removes items from @ARGV my $nomefile = shift; print "Insert query:\n"; chomp(my $query = uc ); my $test = Bio::SeqIO->new( -file => $nomefile, -format => 'fasta'); print "\nResults for $nomefile\n\n"; while (my $seq = $test->next_seq()) { my @pos; my $id = $seq->id; my $fasta = uc $seq->seq; while ($fasta =~ /(?=$query)/g) { push @pos, $-[0] + 1; } if (@pos) { printf "%s compare %d volte in posizione @pos with ID %s\n", $query, scalar @pos, $id; } else { print "$query does not appear in the sequence with ID $id\n"; } }