in reply to Use of uninitialized value??

One of the variables in your string is uninitialized. Check where each one is defined and/or assigned to and make sure they are all being set properly. Perhaps show us the rest of the code and someone might be able to spot which one is causing the problem.

Replies are listed 'Best First'.
Re: Re: Use of uninitialized value??
by powerhouse (Friar) on Jan 28, 2003 at 07:32 UTC
    Thank you. I figured it out, based on what you said. I had not checked to make sure a field was "defined" before I used it to do a if statement.

    Now I am having to go through TONS of lines of different pages to see where else I did that :o(

    Now I know. THANK YOU!

    thx,
    Richard

      Keep in mind that the "Use of uninitialized..." message is only a warning. Strictly speaking you don't have to fix it but naturally it's best to do so.

      The way I commonly fix this is to do:

      if ($variable and $variable eq 'value') { # do something # ... }

      This uses the "short circuit" property of and to check whether the variable is defined before it checks the value. I'm sure some of the more experienced monks can enlighten us as to whether or not this is good practice.

      --
      Grant me the wisdom to shut my mouth when I don't know what I'm talking about.

        Whatch out for:
        if ($variable and $variable eq 'value') { # do something # ... }
        as you are testing not only that the value is defined, but that the value is also not zero or an empty string. As a general practice, you should be writing:
        if ((defined $variable) && ($variable eq 'value')) { # do something # ... }