disable auto-instantiation or warn about it

Jonathan Stowe jns at gellyfish.com
Fri Jul 13 16:13:30 BST 2007

On Fri, 2007-07-13 at 15:54 +0100, Frank v Waveren wrote:
> Lectori Salutem (or, if you prefer, "Hello"),
> I'm going to veer dangerously on-topic here and ask a perl question

ITYM "off-topic"

> that's been bothering me for some time:
> Is there any way to turn off auto-instantiation, or at least to make
> perl emit a warning when it happens?
> The auto-instantiation I mean here is the kind that makes evaluating
> "$foo->{bar}" turn $foo into a hashref if it's undef. It's a nice
> feature in some cases, but especially in larger projects it's a huge
> source of bugs, in my experience.

It's generally called auto-vivification. However you want to "use
strict" that will stop that particular class of bug.

> Alternatively, for a partial credit, you can tell me how to delete a
> file starting with -.



More information about the london.pm mailing list