Since the release of Perl 5.6 in 2000 we can and should use the warnings pragma. It allows the turning on and off of warnings in lexical blocks, that is withing any set of curly praces.

It also allows us to create our own warnings together with our own warning categories.