The debug code block in there lets me see the contents of the array I'm pushing data onto. I checked the contents in array, and they are loading correctly. The problem is in my bottom 'if' statement. When I try to utilize the values in the array within the 'if' statement, the Perl interpreter tells me: "Use of uninitialized value in numeric eq (==)," at this line. I'm not sure why, but this looks like I'm accessing the array out of scope. Does anyone know what's wrong?push( @next_cell_arr, $protein_matrix[$row][$col+1] ); push( @next_cell_arr, $protein_matrix[$row+1][$col+1] ); push( @next_cell_arr, $protein_matrix[$row+1][$col] ); # - debug #$arr_len = scalar @next_cell_arr; #for( $var = 0; $var < $arr_len; $var++ ){ # print $next_cell_arr[$var]; # print "\n"; #} #print "\n\n"; #exit; # - debug # - if all values are equal, then the sequence gets a match of + suffers a mismatch (diagonal move), and not a gap penalty. This als +o saves me from having to compute the max of the three cells if( ($next_cell_arr[0] == $next_cell_arr[1]) && ($next_cell_ar +r[1] == $next_cell_arr[2]) ){ push( @sequence_2_arr, $protein_matrix[0][$col+1] ); push( @sequence_1_arr, $protein_matrix[$row+1][0] ); $dowhat = "diagonal"; }
In reply to Understanding variable scope in perl by BioBoy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |