in reply to Re: Unusual way of accessing hash values
in thread Unusual way of accessing hash values

One other reason I sometimes temporarily turn on diagnostics is to find out what keyword to use when I want to selectively turn off a particular group of warnings. For example, in this case yo see that the body of the diagnostic message begins with (D deprecated). If for some reason I wanted to turn off such warnings in a suitably narrowed scope, I would do this:

use strict; use warnings; # ... { no warnings 'deprecated'; %hash->{ silly } = 'foo'; }
Granted, I can't think of any good reason for turning off this particular warning (except perhaps globally on a large body of legacy code), but there are more realistic examples. E.g.:
use strict; use warnings; require Exporter; { no warnings 'once'; *import = \&Exporter::import; }
The no warnings above silences a warning of the form
Name "main::import" used only once: possible typo...

Yes, one could silence this warning like this instead:

*import = *import = \&Exporter::import;
...but I digress.

the lowliest monk