#!/usr/bin/perl -w use strict; use Bio::SeqIO; my @files = <*.seq>; my $pattern = '[AN]{10}'; foreach my $file (@files) { my $seqio = Bio::SeqIO->new( -file => $file ); while ( my $seqobj = $seqio->next_seq() ) { my $raw_seq = $seqobj->seq(); if ( $raw_seq =~ /$pattern/o ) { print "Found a polyA tail in $file.\n"; } } } #### Found a polyA tail in myfile Found a polyA tail in myfile