Merlyn is unsurprisingly right in calling your usage a "syntactic" comma. I find that some folks find undef a bit too magical. In your second example, you use
undef as a value. You also know that
undef can be used as a function (eq.
undef(@my_long_list);). You might also know that constants in Perl are implemented as functions that return the desired value (eq.
sub pi(){ 3.14}; print 2 * PI;). When using the value
undef, I find it helpful to think of that as a function call returning the value
undef. With that in mind, I would have been surprised to learn that
(1, , , 2) inserted
undef. That seems a little too magical even for Perl, but do read perlfunc's
description of split (/ / versus " ") for a mind-blower.
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.