In general it's better to work around a specific warning that you've verified is harmless by a code change; that way, you don't turn off warnings other than the specific one you are concerned about. In the example you give, you are also turning off warnings about non-numeric data in $sum, @weights, and @digits, which is a different concern than undefs.