No, it's not a special case of #1. It's a special case of something that's unmentioned: creating temporary values in aggregates. Consider this:
#!/usr/bin/perl
use strict;
use warnings;
my @things = qw /foo bar baz/;
sub do_print {
print "@things\n";
}
sub show {
local $things[1] = 'qux';
do_print;
}
show;
do_print;
__END__
foo qux baz
foo bar baz
In the subroutine show, local is used to temporary set the value of the second element to something else. Upon leaving the block, the old value is restored.
This is not mentioned in Dominus' article, and this is what rinceWind is using. The fact that %ENV is special is irrelevant.
|