package Bad; use warnings; sub gen_warning { print "Undeclared: >>>$x<<<"; } 1; #### $ perl -le ' use Bad; Bad::gen_warning(); ' Use of uninitialized value $Bad::x in concatenation (.) or string at Bad.pm line 6. Undeclared: >>><<< #### $ perl -le ' use Bad; { no warnings; Bad::gen_warning(); } ' Use of uninitialized value $Bad::x in concatenation (.) or string at Bad.pm line 6. Undeclared: >>><<< #### $ perl -le ' use Bad; { no warnings "redefine"; sub Bad::gen_warning { use warnings "redefine"; no warnings "uninitialized"; print "Undeclared: >>>$x<<<"; } } Bad::gen_warning(); ' Undeclared: >>><<<