Daniel Kasak wrote: > Hi all. > > I'm after people's thoughts on Perl's warnings about 'Use of > uninitialized value' in various situations ( string comparisons, > subroutine entries, etc ). > I understand what the warning is for. > In my code, it's perfectly OK for my variables to be uninitialised, > and is beyond my control anyway - the data is coming from a database, > and an undef value is perfectly legal ( NULL fields ). > > I can make Perl stop complaining about it by placing if() statements > around everything, eg: > if you are using : use warnings;
Then you can use 'no warnings;' just like you would use 'use warnings' to turn off. Then you can use 'use warnings' to get it goint again. The better point might be to surround what you want within {}'s and use your 'no warnings' and once you hit the ending }, then will return to using warnings again. Wags ;) > if ($value) { > if ($value eq "some_value_to_compare_to") { > # stuff > } else { > # other stuff > } > } else { > # same as other stuff above > } > > But this makes things look overly complicated, increases the size of > my code, and I assume slows things down because I'm doing an extra > comparison that I honestly don't need to be doing. > > Is there any way to prevent 'Use of uninitialized value' warnings > without doing an extra test as above ( and still keeping warnings > turned on )? > > Thanks :) > > -- > Daniel Kasak > IT Developer > NUS Consulting Group > Level 5, 77 Pacific Highway > North Sydney, NSW, Australia 2060 > T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 > email: [EMAIL PROTECTED] > website: http://www.nusconsulting.com.au ******************************************************* This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. ******************************************************* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>