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 ($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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to