There is three steps to what happens here: the values from the variables are read, then the various resulting strings are passed to a series of concatenation ops, and finally the result is passed to print.
The existence of a variable is only apparent in step 1, but reading an undefined value from a value is not and should not elicit a warning. During the concatenation step where the undef is encountered and warned about, its relation to a variable is unknown. You could just as well write
print 1 . " " . 2 . " " . 3 . " " . 4 . " " . undef;
From the concatenation operation's point of view, there's no difference to your own code.
While this situation seems trivial to a human, it is decidedly non-trivial to handle; you would need logic close to a generic partial evaluator to solve this matter.
Makeshifts last the longest.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||