First saying that you can't think of any case where using
a single element list
ever (emphasis yours) makes
sense, and then dismissing the first counter example as
"contrived" doesn't make for a useful discussion.
You couldn't image any way where using a single element
list would be useful, and given an example, you can't image
you ever using it. Does that carry any weight? Or does that
just mean your imagination is limited?
The fact that you would use different code isn't something
I care about. More ways of doing something in Perl is a
feature of Perl. I already pointed out there are different
ways of doing the same. (Not that your code does the same,
it stores the results in a scalar, while my code stores it
in an array). But that doesn't mean other ways should be
warned against - we do like people to use warnings, but
too many warnings just means people will turn them off.
Now, to repeat my unanswered question, do you have an
example (and it better be a good one, or someone will
dismiss it as 'contrived'), where using @array[0]
in a non-lvalue context could cause a result different
from using $array[0]?
Abigail
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.