afaik, there is not.

As an aside, I completely disagree with your statement. When I'm reading code (mine or someone elses), it is inherently easier to know the intention of $x[0] directly than it is to have to scroll through to find out first where $a came from, and then have to do it again to find out how it got back into @x (imho).

Also, using $a and $b is not advised much of the time, as they are special variables when one is using sort. This recommendation is contentious with some people, especially if you meant it only as an example... but I thought I'd point it out anyways.

Update: unless I'm misunderstanding the question, the OP does not want to use the syntax of $x[0] at all, and instead just use a single variable that references the element. I'll let OP clarify.


In reply to Re: referencing list by stevieb
in thread referencing list by pmilne

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.