danmcb has asked for the wisdom of the Perl Monks concerning the following question:
It would be nice if there was a way to prevent the following typo-style errors for hashrefs, as 'strict' does for vars:
my $href = { key1 => 'foo' }; . . . if ( $href->{key_1} eq 'foo' ) { # celebrate wildly }
Of course, one could use 'defined' to tighten up the code. But it would be nice to stop hashrefs being accidentally abused somehow. As far as I know though, this is not really possible in a strict-like way, only on an ad-hoc basis. Any thoughts?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strict and hashrefs
by moritz (Cardinal) on Nov 17, 2009 at 15:54 UTC | |
|
Re: strict and hashrefs
by kennethk (Abbot) on Nov 17, 2009 at 16:18 UTC | |
|
Re: strict and hashrefs
by JadeNB (Chaplain) on Nov 17, 2009 at 17:47 UTC |