in reply to Re: An eighth use of local
in thread An eighth use of local
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:
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.#!/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
This is not mentioned in Dominus' article, and this is what rinceWind is using. The fact that %ENV is special is irrelevant.
Perl --((8:>*
In Section
Meditations