[Bioperl-l] Problems with a while loop, please help

manni122 markus.liebscher at gmx.de
Mon Mar 16 11:29:14 UTC 2009


Hi there, I need a little bit help in simple programming. I have two arrays
in which codons are stored. These arrays I need to compare. If I find
similar codons at the same position in both arrays everything is fine, if
not I am splitting every codon further into the bases.

		@zwvalue1 = split(//, $value1);
		@zwvalue2 = split(//, $value2); 

And then I want to compare base 1 from array 1 with base 1 from array 2 and
so on. But if I am looking at the values from the following while loop
		
			my $k = 0;
			
			while ($k <= 2) {
			$value1a = @zwvalue1[$k];
			$value1b = @zwvalue2[$k];
			$value2a = @zwvalue1[$k+1];
			$value2b = @zwvalue2[$k+1];
			$value3a = @zwvalue1[$k+2];
			$value3b = @zwvalue2[$k+2];
			
			print "@zwvalue1, $value1a, $value2a, $value3a\n";			
			}
		    continue {
		    $k++;

I get as output for example:
T A A, T, A, A
T A A, A, A,
T A A, A, ,

Why is this loop running 3times? I just need this loop running once to
compare all three bases at one time.
Any help is appreciated.
-- 
View this message in context: http://www.nabble.com/Problems-with-a-while-loop%2C-please-help-tp22536301p22536301.html
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.




More information about the Bioperl-l mailing list