in reply to Re^5: need help with a regex
in thread need help with a regex

Final code, FYI: Thanks again
#!/usr/bin/perl use strict; use warnings; my $infile = $ARGV[0]; unless (open (INFILE, "$infile")){ print STDERR "Can't open $infile $!\n"; die; } my ($header, $count , $match) = ('',0,0); print "\n\n"; #This algorithm will work only when the sequence is on one line while (<INFILE>) { chomp; if ($_ =~ />(.*)/) { #a header line $header = $1; $count++; #keep running total of seque +nce number } else { #not a header my $i = 0; while ( $_ =~ /([VILMFWCA]{8,})/g) { my $domain = $1; my $len = length $doma +in; $len--; if ($i == 0){ print "Hydroph +obic strecth found in: $header\n"; $match++; $i++; } print "$domain\n"; print "The match was a +t potistion: ", pos() - $len, "\n";; } if ($i > 0){ print "\n\n"; } } } close INFILE; print "Hydrophobic region(s) found in $match sequences out of $count s +equences\n";