in reply to Why did this error slip through?
Hashes accept barewords in their braces and treat them as the keys. Perl interprets your line
delete $ENV{_}
just like it treats the next line:
print "$ENV{FOO}\n";
There is little way around that because the second usage is quite common. You could potentially set up some policy for Perl::Critic to prohibit/flag usage of bare hash keys that do not start with [A-Za-z] or something like that. Perl more or less considers everything matching /\s*\w+\s*/ as a valid bareword hash key (he says without checking).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why did this error slip through?
by rovf (Priest) on May 17, 2010 at 11:27 UTC |