On Sat, Jun 29, 2002 at 02:20:00AM -0700, Dan Fish wrote:
> Correct if I'm wrong, but I think I understand the following warning means
> I'm trying to make use of an empty or undef variable, 
As it says in perldoc perldiag:

       Use of uninitialized value%s
           (W uninitialized) An undefined value was used as if it
           were already defined.  It was interpreted as a "" or a
           0, but maybe it was a mistake.  To suppress this warn-
           ing assign a defined value to your variables.

So you are nearly right; you're using an undefined variable, but an "empty"
variable can mean something else.

> but if the problem isn't obvious, how do I find it? and what does the
> chunk # mean?
 
> Use of uninitialized value at MMC/Online_Entry.pm line 47, <INFILE> chunk
> 541.

The chunk part means you were in the process of reading <INFILE> when you
tried to use an undefined variable.  Think of "chunk" as "line"; It says
chunk instead of line because you can redefine how the file is split up into
chunks.

There are two good methods for determining which of the variables you're
using is undefined.  You can use the debugger (perldoc perldebug), set a
breakpoint at line 47, then check each suspect variable.

If you don't like that idea, you can insert print statements in the code
that prints out each variable, and check them that way.  If you print each
variable with its own print statement you can pinpoint the line that way, or
you can use something like:

    print "variable1: " . defined($variable1) ? $variable1 : "undef";

Does that answer your questions?


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to