Henry Hung-Yung Wang wrote: > I have just written some codes, but they are not doing what I wanted them > to do. Here are the codes: > > @motif= ('ACGTACGT', 'AAAATTTT', 'CCGGCCGG', 'GGCCGGCC'); > > print "Please enter sequences to be examined:\n\n"; > $dna=<STDIN>; chomp $dna; > > @dna=split (//, $dna);
What's your regexp to split. split //, $dna uses the last regexp used in the program. Perhaps you meant split /\w/, $dna ?! > foreach $bp (0..$#dna-8){ > $eightmer=join ('', @dna[$bp, $bp+1, $bp+2, $bp+3, $bp+4, $bp+5, $bp+6, > $bp+7]); Well, thats strange. It is simplier written as: $eightmer = join ('', @dna[$bp .. $bp+7]); > if ($eightmer=~ $motif[0]){ > print "This sequence, $eightmer, is palindromic\n\n"; > } else { > print "There is no other palindromic sequences\n\n"; > exit; You exit whole the foreach loop when the FIRST NON-Palindromic sequence is found. > } > } > > I am trying to take the input and make them into sequences of 8 letters. > Then I want to match the sequences with the 'motif' defined in the codes. > However, when I run the program, the only motif that was recognized was > 'AAAATTTT'. What am I doing wrong here? Thanks for the help. > Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]