in reply to Example of brainfog (Was: inconsistent regex matching)

First, thanks to all who tried to help... and especially to those (most of you) of nailed the problem immediately, pointing out that the way I used the input record separator, $/, had logical problems, as AnomalousMonk, tye (second guess) and Athanasius noted.

The solution involved simply moving - as an elsif... - the /$eot/ test down below the regex looking for error messages (Ln33-34 in the OP's "whereas...." code block).

... and for anyone still reading, mea culpa, I should have noted (in the OP!) that the html in the raw data horribly and unnecessarily convoluted and that the /$eot/ sequence occurs only once at the very end of the data file. Its only utility is to supress an inconsequential warning. Also,  my $trterminator = qr[</tr>\n</table></td></tr></table>]; is never used (it appears only once but that did not produce any warnings, an occurance suggesting I better review the docs).

Still, despite the shortcomings of the OP, Monks and the Monastery came thru in "class A" fashion. Again, thanks!

check Ln42!

Replies are listed 'Best First'.
Re^2: Example of brainfog (Was: inconsistent regex matching)
by Athanasius (Archbishop) on Nov 23, 2015 at 03:09 UTC
    Also,  my $trterminator = qr[</tr>\n</table></td></tr></table>]; is never used (it appears only once but that did not produce any warnings, an occurance suggesting I better review the docs).

    Interesting. I noticed that my $trterminator is never used, but overlooked the fact that no warning is generated. Turns out, that’s the expected behaviour. From perldiag:

    Name "%s::%s" used only once: possible typo

    (W once) Typographical errors often show up as unique variable names. If you had a good reason for having a unique name, then just mention it again somehow to suppress the message. The our declaration is also provided for this purpose.

    NOTE: This warning detects package symbols that have been used only once. This means lexical variables will never trigger this warning.

    Related threads:

    I’ve learnt something! Also warnings::unused could be a helpful addition to the toolbox:

    13:02 >perl -wE "my $x = 42; say 'hi';" hi 13:02 >perl -Mwarnings::unused -wE "my $x = 42; say 'hi';" hi Unused variable my $x at -e line 1. 13:02 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,