It seems to me that there is a considerable difference between using a variable who current value is undef, and using undef explicitly.
And that, at least for built-ins that have (or could have) access to the information to know the difference, they could (and should?) be treated differently.
I'm not aware of that difference in any existing perl built-ins (except those which modify their arguments).
Introducing such a difference would only lead to questions of the form "how can I change my code so that it acts as if it were a literal, not a variable?", and no real benefit.
If I pass a varible who's current value is undef, there is a possibility that it is an accident of bad flow control. If I pass undef explicitly, I've chosen to do so.... and you've chosen to get the warning.
I don't see why you should ever use a literal undef when you really should be using an empty string, and expect not to get a warning. I also don't see how undef would be more perlish than the empty string.
In reply to Re^5: Use of uninitialized value in substr
by moritz
in thread Use of uninitialized value in substr
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |