Even though it is correct

It is not correct. Your examples prove that you're wrong.

strict's error message is that strict doesn't understand the LIST arguments. Perl understands them just fine. The set error message is that Perl didn't find a set.pm module. Perl understood the LIST arguments just fine.

Please stop posting nonsense. You're wasting time and hurting people who don't know enough to ignore your ignorance.

Update: I reread this and realized the nonsense went even deeper.

The intended declaration of $y did not succeed

Indeed it did. That's why strict complains about the unrecognized tag '666'.

There is probably a “hole” in the BNF grammar within the interpreter.

Utter nonsense, which proves you didn't bother to look at the grammar at all.

First of all, there's no "BNF grammar" in the interpreter. There's a parser and a lexer which you could, if you were enterprising enough, potentially represent in Backus-Naur Form, but it's not expressed as such anywhere within the Perl source code, and there is no singular representation of grammar within the Perl source.

Second of all, you're expressing surprise that assignment is an expression. In other words, by your logic, the fact that $x = $y = $z works is an unanticipated accident of implementation that should be fixed. Similarly, (my $x = $y) =~ s/\A\s+|\s+\Z//g; should not work, in your incorrect interpretation of Perl.

Arguably, you could be complaining that lexical declaration should not be allowed in expressions, which is still a silly point given the en-passant assignment and substitution technique of the previous snippet, but witness:

sub main { foo(my $x = 1); say $x; return 0; } sub foo { say ++$_[0] . ' in foo'; }

... or:

sub main { bar(my $x); say $x; return 0; } sub bar { $_[0] = 'assigned in bar'; }

Should you write code like that? I think we all know the answer—but let's not delude ourselves into pretending that this is some unintentional side effect of implementation. Assignment-as-expression semantics, along with compile time variable declaration, are well established in Perl. Misunderstand them at your own peril.


In reply to Re^4: use has it's own scope? by chromatic
in thread use has it's own scope? by LanX

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.