I did not answer it because I never disputed whether a single element slice rvalue does the right thing in the first place.

Note (again) that I'm specifically talking about the case with a constant index. Maybe my imagination is indeed limited. I'm honestly tempted to grep all of CPAN to find out whether anyone else has ever found it useful.

But let's accept your argument that it's in the spirit of TMTOWTDI to use it that way as an lvalue and therefor shouldn't be warned against when other similar ways aren't. Let's also accept your agument that it doesn't behave any differently than $array[42] as an rvalue.

I offer that it is a fact that a (even slightly) seasoned Perl programmer will instinctively use the $array[42] notation.

Then is there any argument you can make against warning about it when used as an rvalue (but not lvalue)?

(PS: If you want to talk about too many warnings, you're invited to talk about "used only once"..)

Makeshifts last the longest.


In reply to Re^6: @array[1] is valid?? by Aristotle
in thread @array[1] is valid?? by jdklueber

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.