while($seq =~ /([VILMFWCA]{8,})/g){ #search for desired sequence my $location = pos($seq); #find location my $length = length($1); #determine length print "Hydrophobic stretch found in: ", $header, "\n"; #printing outputs for results print $1, "\n"; print "The match was at position: ", $location - $length + 1, "\n\n"; }