in reply to Re: Re: I need a simple explantion of the difference between my() and local()
in thread I need a simple explantion of the difference between my() and local()
No, it doesn't do that. Too bad you didn't try it!my $x = 2; sub A { local $x = 3; &B; } sub B{ $x } print &A; #prints 3 not 2
"Always use my, never use local" is advice for people who don't understand the complexities yet. It's like the rule your mom told you about not talking to strangers. Is it always wrong to talk to strangers? No, of course not. Can a little kid be trusted to know when the rule doesn't apply? No.
So until Jemts can read those tutorials and understand what they mean, he's better off following the rule. You might be better off also---it would at least stop you from saying silly things on Perlmonks.
--
Mark Dominus
Perl Paraphernalia
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I need a simple explantion of the difference between my() and local()
by ctl (Acolyte) on May 03, 2001 at 07:57 UTC | |
by Dominus (Parson) on May 03, 2001 at 19:22 UTC |