in reply to Understanding variable scope in perl
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Understanding variable scope in perl
by graff (Chancellor) on Sep 29, 2005 at 21:58 UTC | |
by BioBoy (Novice) on Sep 29, 2005 at 23:27 UTC | |
|
Re^2: Understanding variable scope in perl
by liverpole (Monsignor) on Sep 29, 2005 at 19:14 UTC | |
by BioBoy (Novice) on Sep 29, 2005 at 23:16 UTC | |
by liverpole (Monsignor) on Sep 29, 2005 at 23:37 UTC | |
|
Re^2: Understanding variable scope in perl
by kwaping (Priest) on Sep 29, 2005 at 19:13 UTC | |
by liverpole (Monsignor) on Sep 29, 2005 at 19:31 UTC |