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

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,