in reply to Annoying 'Use of uninitialized value in concatenation' warning

What runrig said.

The reason for having a warning about this is that while undef is a perfectly valid value for a variable, it has no textual representation. Printing it will render it as an empty string but Perl will warn you that what you're seeing may not be what you wanted. More often than not, having undefs printed indicates that you forgot to calculate/read/whatever some value.

  • Comment on Re: Annoying 'Use of uninitialized value in concatenation' warning

Replies are listed 'Best First'.
Re^2: Annoying 'Use of uninitialized value in concatenation' warning
by JavaFan (Canon) on Oct 26, 2011 at 11:59 UTC
    The reason for having a warning about this is that while undef is a perfectly valid value for a variable, it has no textual representation.
    Bullshit.

    There are also characters that have no textual representation, and using them doesn't warn.

    Note that the warning from the OP isn't even about printing - it's about concatenation. There's a perfectly good reason why most operations warn if one of its operands is undefined, but having no textual representation isn't that reason.