Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Use of uninitialized value in concatenation (.) or string

by KPeter0314 (Deacon)
on May 20, 2003 at 14:48 UTC ( [id://259473]=note: print w/replies, xml ) Need Help??


in reply to Use of uninitialized value in concatenation (.) or string

Japhy is right, initialization is the key.

I sheepishly admit I come from the old school where declaring variables is necessary. A sideline from starting as a COBOL, RPG, and Transact programmer. It became a habit and use strict; requires it. See Perldoc strict for more info.

This will get you there:

use vars qw($OURVAR) = ();
Add other variables inside the parens to initialize them too.

-Kurt

Replies are listed 'Best First'.
Re: Re: Use of uninitialized value in concatenation (.) or string
by P0w3rK!d (Pilgrim) on May 20, 2003 at 15:18 UTC
    Read the code again. use strict; is everywhere.
    Thanks :)
      What is meant is that use strict; requires that variables be initialized.

      To quote from the perldoc:strict where strict vars is implied by not specifying what to be strict about:

      "strict vars" This generates a compile-time error if you access a variable that wasn't declared via "our" or "use vars", localized via "my()", or wasn't fully qualified.
      The use vars qw($OURVAR) = (); pragma actually declares the variable $OURVAR and initializes it to a known null value instead of leaving it uninitialized. Perl cares about the difference.

      -Kurt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://259473]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-25 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found