Re: empty variables - getting rid of "uninitialized value" warnings?
- From: Tomasz Chmielewski <tch@xxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 29 Mar 2008 16:41:45 +0100
Gunnar Hjalmarsson schrieb:
Thrill5 wrote:"Tomasz Chmielewski" <tch@xxxxxxxxxxxxxxxxxxxx> wrote in message news:fsie2l$g0f$1@xxxxxxxxxxxxHow can I get rid of warnings if I make tests with "if" and some variables are empty?
Should I just ignore it? Or use "no warnings" just for that piece of code throwing a warning?
Try:
use strict;
use warnings;
no warnings 'uninitialized';
This will turn off only the uninitialized variable warnings, and keep all the other warnings. I find those warnings are more trouble to get rid of then the value that the warning provides.
Even if that may be true in some cases, it's not true in this case IMO. If you write code that does not generate such warnings, you increase the chance that there are no bugs. The OP has already received a few suggestions.
Also, if you want to disable 'uninitialized' warnings, you'd better do so in the block(s) where it's needed, and not disable them for the whole program.
Thanks all in this thread for useful suggestions!
--
Tomasz Chmielewski
http://wpkg.org
.
- References:
- empty variables - getting rid of "uninitialized value" warnings?
- From: Tomasz Chmielewski
- Re: empty variables - getting rid of "uninitialized value" warnings?
- From: Thrill5
- Re: empty variables - getting rid of "uninitialized value" warnings?
- From: Gunnar Hjalmarsson
- empty variables - getting rid of "uninitialized value" warnings?
- Prev by Date: Re: Memory issues
- Next by Date: Re: Readline using foreach and while
- Previous by thread: Re: empty variables - getting rid of "uninitialized value" warnings?
- Next by thread: Re: empty variables - getting rid of "uninitialized value" warnings?
- Index(es):
Relevant Pages
|