Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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:

perl -d 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 ) {
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")

In reply to (tye)Re: uninitialized weirdness by tye
in thread uninitialized weirdness by vaevictus

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-05-30 06:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found