http://www.perlmonks.org?node_id=834909

mikeraz has asked for the wisdom of the Perl Monks concerning the following question:

Well this should be a no brainer:

Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/5.8.5/Net/OUR/DNS.pm line 139 (#1) Where: 139 print __LINE__, " our_fqdn called with $host state_code $state_cod +e and thus region of $region_code \n"; Outputs: 139 our_fqdn called with scdor44s4q1rr.nw.us.our-dns.com state_code OR + and thus region of NW
All the values are being printed, indicating to my mind that they were initialized. But Perl says otherwise.

Cluestick whack requested.


Be Appropriate && Follow Your Curiosity

Replies are listed 'Best First'.
Re: Use of uninitialized value in concatenation (.) or string
by cdarke (Prior) on Apr 15, 2010 at 15:31 UTC
    The line shown appears to be correct - I tried it with values for the variables. So, I hate to ask the basic questions but it has got to come down to one of these:
    1. Are you using warnings and strict? If you are not using strict then you might wish to consider setting it on as a test using -Mstrict on the command-line.
    2. Are you certain that the line you show is really the line it is reporting the error on? Could it be using a different version of the module?

    By the way, 5.12 reports the variable name that is uninitialized.
Re: Use of uninitialized value in concatenation (.) or string
by ikegami (Patriarch) on Apr 15, 2010 at 15:31 UTC
    Maybe the warning isn't coming from that line, or maybe it's coming from a different run of that line.

      That appears to be the case. The debug messages were popping up out of sync with the calling program print statements.

      Thank you.


      Be Appropriate && Follow Your Curiosity
Re: Use of uninitialized value in concatenation (.) or string
by choroba (Cardinal) on Apr 15, 2010 at 15:20 UTC
    Strange indeed. Can you show neighbouring lines in the code and in the output as well?