> -----Original Message-----
> From: Nandita Mullapudi [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 08, 2002 3:49 PM
> To: [EMAIL PROTECTED]
> Subject: use of uninitialised value... 
> 
> 
> i'm trying to run a perl script written to parse a file, and 
> it runs fine
> the way it is written, however, after making little changes 
> to accomodate
> my file, i get inundated with the following message
> 
> "Use of uninitialized value in hash element at modif2.pl line 90"
> 
> can any1 tell me what this means?
> many thanks
> nandita 

The handy "splain" program that comes with Perl can help:

$ echo "Use of uninitialized value in hash element at modif2.pl line 90" |
splain
Use of uninitialized value in hash element at modif2.pl line 90 (#1)

    (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 warning assign a defined value to your variables.

    To help you figure out what was undefined, perl tells you what operation
    you used the undefined value in.  Note, however, that perl optimizes
your
    program and the operation displayed in the warning may not necessarily
    appear literally in your program.  For example, "that $foo" is
    usually optimized into "that " . $foo, and the warning will refer to
    the concatenation (.) operator, even though there is no . in your
    program.

Assuming that your program correctly handles the undefined value as "" or 0,
you can suppress the warning by adding:

    no warnings 'uninitialized';

This declaration can be placed inside a block to limit its scope, or you can
just put it at the top of the script to suppress these warnings throughout.

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

Reply via email to