Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Warnings:

by vagnerr (Prior)
on Jun 08, 2002 at 01:31 UTC ( #172719=note: print w/ replies, xml ) Need Help??


in reply to Uninitialized value in string warnings (was: Warnings:)

You could try using diagnostics:-
just add the following to your program

use diagnostics;
you may need to comment out use strict; and remove the '-w' flag. What diagnostics does is give you a discription of what may be the problem.

In you particular case you are faced with using a possibly undefined variable as you have stated. You could either go ahead with your proposed idea, or "initialise" everything at the start of your code. EG
$a=""; $b=""; $c="";
Or you could put your potentialy uninitialied variable into a safe state after it is defined and before use eg.
$b = defined($b)?$b:"";


Hope this helps.

---If it doesn't fit use a bigger hammer


Comment on Re: Warnings:
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Warnings:
by Anonymous Monk on Jun 08, 2002 at 08:55 UTC

    I'm already using:

    #!perl.exe -w use strict; use diagnostics;

    but I don't want to turn off warnings or strict for the whole program to avoid this which I know about and am ready to except.

    See above (or below?) for my reply to the previous poster for why I was trying to avoid the ternary op.

    Thanks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2015-07-29 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls