Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Uninitialized Value Warning

by Anonymous Monk
on Oct 22, 2003 at 17:33 UTC ( [id://301382]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Uninitialized Value Warning
in thread Uninitialized Value Warning

Nothing, that was just an example of a problem I have seen in other scripts, however you provided the answer. Sorry to be stupid, but I didn't take the term "uninitialized" to mean null.

Anyway, problem solved.

Replies are listed 'Best First'.
Re: Re: Re: Uninitialized Value Warning
by bobn (Chaplain) on Oct 22, 2003 at 18:30 UTC

    It's not null. Null is a value (or at least the specific absence of one). It's uninitialized - there's never been a value assigned, and although Perl will try to do the right thing and assume 0 in numeric context or the empty string in string context, it really is just what it says: uninitialized.

    Update: Just remembered, some DBs use Null the way you did, I think.

    --Bob Niederman, http://bob-n.com

    All code given here is UNTESTED unless otherwise stated.

Re: Re: Re: Uninitialized Value Warning
by thelenm (Vicar) on Oct 22, 2003 at 19:06 UTC

    It basically means you used a variable with the value undef in a string concatenation (which is what string interpolation does under the covers)... er, array index in this case, but the warning is emitted whenever an undefined value is used as if it were already defined. "Uninitialized" may be a little misleading because you can still get this warning even if the variable has had a value assigned to it before:

    use warnings; my $str = 'foo'; print "$str\n"; # ok $str = undef; print "$str\n"; # emits "uninitialized" warning

    By the way, you can see detailed explanations of pretty much all Perl warnings by checking out the perldiag documentation (run perldoc perldiag).

    -- Mike

    --
    XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
    -- grantm, perldoc XML::Simpler

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://301382]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.