This is not about " concatenating undef to a string.".
That's exactly what happens to the 4th arg of substr.
Yes, you could suppress it, but why should you have to for something that could not possibly by "by accident".
eh? Of course you can pass an undefined value to substr by accident.
The real question is about making explicit undef semantically different from indirect undef
ah! There wasn't even an allusion to this. It's not even an existing concept in Perl as far as anyone is concerned. (Yes, I'm aware there's an instance where literal undef is special in an obscure and unused usage of a builtin, but it's not info I keep in my mind.)
No thanks for this feature. The following come to mind:
- It's a solution in search of a problem
- It adds magic to avoid clear, concise code.
- It adds a whole new type of variable with high cost and low gains.
- It adds inconsistencies to the warning system.
- It adds inconsistencies to substr.
It's not one of those cases where I can'tcan provide concrete explanation or example. It just reeks of trouble.
Update: Spelled out some of the reasons.
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.