Again, from perlsub....
Under 
 When to Still Use local()
....
     3.  You want to temporarily change just one element of an
         array or hash.

         You can "local"ize just one element of an aggregate.
         Usually this is done on dynamics:

             {
                 local $SIG{INT} = 'IGNORE';
                 funct();                            # uninterruptible
             }
             # interruptibility automatically restored here

==>      But it also works on lexically declared aggregates.
==>      Prior to 5.005, this operation could on occasion
==>      misbehave.

Does that mean if I say

  my @a = (1 2 3);

I can say 

  local $a[1] = 'foo';

and it behaves????
It seems to....

  @a = 'A'..'Z';
  { my @a = (0..9);
    { local $a[3] = 'foo';
      print join '|', @a, "\n";
    }
    print join '|', @a, "\n";
  }
  print join '|', @a, "\n";

prints
======
0|1|2|foo|4|5|6|7|8|9|
0|1|2|3|4|5|6|7|8|9|
A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|

Strange!!!
How does *THAT* work???
This messes up my understanding of symbol tables and scratchpads a
bit.... Not that I everreally understood how you could localize just
one element of an aggregate. I love it, and I do it, and it works, but
I don't really understand *how* it works.....

Somebody clear it all up for me? :)


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to