in reply to uninitialized weirdness
It turns out that $mode is what is undefined. Perl is reporting the wrong line number because it has optimized the entire if/elsif/else into a "case" (or "switch") statement.
Update: Well, the case/switch statement bit may or may not enter into it. I recall old documentation talking about simple if/elsif/else being internally optimized into a case/switch type of flow control. What I have been able to verify is that Perl is not recording line number of the elsif lines. One easy way to see this is:
and notice that the elsif lines don't have colons (":") after their line numbers. This is probably worth bringing to the attention of p5p to see if it can be fixed. - tye (but my friends call me "Tye")perl -d script.pl DB<2> l 32-46 32: if($line =~ m/<!-- LHS movie -->/) { 33: $mode ="LHS"; 34: $moviecounter++; 35: $internal=0; 36 } elsif ($line =~ m/<!-- RHS movie -->/) { 37: $mode = "RHS"; 38: $moviecounter++; 39: $internal=0; 40 } elsif ($line =~ m/<!-- theater -->/) { 41: $mode = "theater"; 42: $counter++; 43: $moviecounter=-1; 44: $internal=0; 45 } elsif ($mode eq "LHS") { 46: if ($internal == 6 ) {
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: uninitialized weirdness
by Dominus (Parson) on Nov 17, 2000 at 08:31 UTC |