A list and an array are two different things. Lists are unbounded series of values, whereas an array is a bounded series of values. Arrays can either live anonymously or symbolically through a variable or variable container. Lists however, can be looked at as scalar values in an unbounded state, as seen in the right-hand side of a list context assignment, subroutine calling/returning (foibles acknowledged), iteration and slicing (and more, no doubt). However, in scalar context what might look like a list is really just the comma operator working on a series of values.
Now, in the case of $aap you're creating a reference to nothing, since there's no such thing as a list in scalar context (in as much as one could admire a 'sunny night') and since perl can't create a reference to nothing, undef is used. On reflection it may seem a little odd that perl allows one to reference nothing, but such is the orthogonality of perl's syntax and (mostly) DWIM nature.
update: added last sentence
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.