rovf has asked for the wisdom of the Perl Monks concerning the following question:
I made the following mistake:
Of course the error is in the delete line, but I wonder why this mistake was not detected by Perl. In this case, _ would be seen as file handle, but this would mean that using a file handle as a hash key would be a legal usage and not even issue a warning! Any comments?use strict; use warnings FATAL => qw(all); ... my @remove_env=qw(FOO BAR BAZ); foreach my $var (@remove_env) { $ENV{$var}='something'; } ... delete $ENV{_} foreach (@remove_env); print "$ENV{FOO}\n"; # FOO stil in environment!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why did this error slip through?
by Corion (Patriarch) on May 17, 2010 at 09:31 UTC | |
by rovf (Priest) on May 17, 2010 at 11:27 UTC | |
|
Re: Why did this error slip through?
by moritz (Cardinal) on May 17, 2010 at 09:31 UTC | |
|
Re: Why did this error slip through?
by JavaFan (Canon) on May 17, 2010 at 09:39 UTC | |
|
Re: Why did this error slip through?
by cdarke (Prior) on May 17, 2010 at 10:54 UTC | |
|
Re: Why did this error slip through?
by rowdog (Curate) on May 17, 2010 at 09:42 UTC |