When I run my code, $val1 is indeed not being defined, but the debug loop, right above, $next_cell_arr[0] is displaying the correct value. This makes absolutely no sense to me. Something so incredibly simple is not working here. EDIT: By the way, I always use the -w flag, but adding 'use warnings' might be easierpush( @next_cell_arr, $protein_matrix[$row][$col+1] );# - note: 'right +' cell is first element of array push( @next_cell_arr, $protein_matrix[$row+1][$col+1] );# - no +te: 'diagonal' cell is second element of array push( @next_cell_arr, $protein_matrix[$row+1][$col] );# - note +: 'bottom' cell is third element of array # - 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 my $val1 = $next_cell_arr[0] || die "val1 is undefined!!\n"; my $val2 = $next_cell_arr[1] || die "val2 is undefined!!\n"; my $val3 = $next_cell_arr[2] || die "val3 is undefined!!\n";
In reply to Re: Understanding variable scope in perl
by BioBoy
in thread Understanding variable scope in perl
by BioBoy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |