http://www.perlmonks.org?node_id=94197

gwhite has asked for the wisdom of the Perl Monks concerning the following question:

I have a Perl CGI program that I am placing the finishing touches on, during debugging I have kept -w and use strict; in the appropriate places.

My input is an HTML form with 100 or more inputs. Which I drop into a hash (%USER) to process. Some of the questions will be left blank or answered with an answer of 0. This causes some of the variables to show as uninitialized in some warning messages. An example of the code that causes this error would be:

if ($USER{coffee} > 5){$msg='You drink too much coffee'}

If $USER{coffee} is left blank or 0 is the response I get a message that says "Use of uninitialized value in numeric gt (>) at .....". OK, I know why that happens, but it seems inappropriate to write the code like:

if ($USER{coffee}){if ($USER{coffee} > 5){$msg='You drink too much coffee'}}

just to eliminate the error message. But my clients are not going to be thrilled with a lot of warning messages like this piling up in the error logs. Since I have run over 10,000 sample data sets through, should I just eliminate the -w for the production code, or have I missed something much more obvious and elegant.

And does use strict; increase the time to load and process the code, which in a production environment after rigorous testing can be eliminated.

Thanks,
Greg