Re: local() on elements of lexical aggregates??? [OT]

2003-02-20 Thread Paul
> > Er? Sorry, I don't mean for this to sound as bad as it does, > > but have you read the docs that *come* with Perl > > i will let you take a guess. Hmm...that sounded even worse than I thought it would. Again, a serious apology. I *really* didn't mean for it to, lol The discussion

Re: local() on elements of lexical aggregates??? [OT]

2003-02-19 Thread David Zhuo
On Wednesday 19 February 2003 08:16, Paul wrote: > > Er? Sorry, I don't mean for this to sound as bad as it does, but > have you read the docs that *come* with Perl i will let you take a guess. > > Perhaps a mistaken assumption. Could someone delineate the difference > between package va

Re: local() on elements of lexical aggregates??? [OT]

2003-02-19 Thread Paul
> >> there is no package variables in Perl, only global or lexical. > > > > Not so -- ALL package variables in Perl *are* global, but likewise > > all global variables in Perl are package vars. Even $_ is > > technically $main::_ so that > > > > $_ = 'foo'; > > package bob; > > print $main:

Re: local() on elements of lexical aggregates???

2003-02-18 Thread John W. Krahn
David wrote: > > Paul wrote: > > > > Not so -- ALL package variables in Perl *are* global, but likewise all > > global variables in Perl are package vars. Even $_ is technically > > $main::_ so that > > > > $_ = 'foo'; > > package bob; > > print $main::_."\n"; > > > > prints "foo" and the ne

Re: local() on elements of lexical aggregates???

2003-02-18 Thread david
Paul wrote: >> > Lexicals aren't in the symbol table. >> > my $foo; >> > *can't* be accessed as $pack::foo, because it isn't IN a package. >> >> true. >> >> > Locals, on the otherhand, *have* to be package variables that can >> > be tracked by $pack::foo syntax. So how can >> > my @bar; >> >

Re: local() on elements of lexical aggregates???

2003-02-18 Thread Paul
> > Lexicals aren't in the symbol table. > > my $foo; > > *can't* be accessed as $pack::foo, because it isn't IN a package. > > true. > > > Locals, on the otherhand, *have* to be package variables that can > > be tracked by $pack::foo syntax. So how can > > my @bar; > > allow > > local $bar

Re: local() on elements of lexical aggregates???

2003-02-18 Thread Paul
--- Jenda Krynicky <[EMAIL PROTECTED]> wrote: > From: Paul <[EMAIL PROTECTED]> > > --- david <[EMAIL PROTECTED]> wrote: > > > Paul wrote: > > > > @a = 'A'..'Z'; > > > > { my @a = (0..9); > > > > { local $a[3] = 'foo'; > > > > print join '|', @a, "\n"; > > > > } > > > > print

Re: local() on elements of lexical aggregates???

2003-02-18 Thread Jenda Krynicky
From: Paul <[EMAIL PROTECTED]> > --- david <[EMAIL PROTECTED]> wrote: > > Paul wrote: > > > @a = 'A'..'Z'; > > > { my @a = (0..9); > > > { local $a[3] = 'foo'; > > > print join '|', @a, "\n"; > > > } > > > print join '|', @a, "\n"; > > > } > > > print join '|', @a, "\n"; >

Re: local() on elements of lexical aggregates???

2003-02-18 Thread david
Paul wrote: > > Lexicals aren't in the symbol table. > > my $foo; > > *can't* be accessed as $pack::foo, because it isn't IN a package. > true. > Locals, on the otherhand, *have* to be package variables that can be > tracked by $pack::foo syntax. So how can > > my @bar; > > allow > >

Re: local() on elements of lexical aggregates???

2003-02-18 Thread Paul
--- david <[EMAIL PROTECTED]> wrote: > Paul wrote: > > @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|

Re: local() on elements of lexical aggregates???

2003-02-18 Thread david
Paul wrote: > @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

local() on elements of lexical aggregates???

2003-02-18 Thread Paul
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