The spurious error message appeared in 5.20 and got fixed in 5.38.

I think the following excerpt from the 5.38.0 perldelta is relevant here:
Syntax errors no longer produce "phantom error messages" Generally perl will continue parsing the source code even after encountering a compile error. In many cases this is helpful, for instance with misspelled variable names it is helpful to show as m +any examples of the error as possible. But in the case of syntax error +s continuing often produces bizarre error messages and may even caus +e segmentation faults during the compile process. In this release th +e compiler will halt at the first syntax error encountered. This mea +ns that any code expecting to see the specific error messages we used + to produce will be broken. The error that is emitted will be one of t +he diagnostics that used to be produced, but in some cases some messa +ges that used to be produced will no longer be displayed. See "Changes to Existing Diagnostics" for more details.
Cheers,
Rob

In reply to Re^2: Where does the spurious error message come from? by syphilis
in thread Where does the spurious error message come from? by kikuchiyo

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.