Re: my, my...

2006-12-17 Thread Jorge Almeida
On Sun, 17 Dec 2006, Jeff Pang wrote: There is a good article about Perl's variable scope. I think you maybe need to take some time to read it seriously: http://perl.plover.com/FAQs/Namespaces.html.en Good link. Thanks. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

Re: my, my...

2006-12-17 Thread Jeff Pang
>> >My only problem was that the variable in the subroutine was not declared >with my nor our, not on purpose. I didn't know that you could do that >when using strict. I always use my or our, so I hadn't encounter this >behaviour yet. > There is a good article about Perl's variable scope. I think

Re: my, my...

2006-12-15 Thread Chad Perrin
On Fri, Dec 15, 2006 at 10:51:09AM +, Jorge Almeida wrote: > I thought I already knew a few things about Perl, but I just found out I > don't: > #!/usr/bin/perl -w > use strict; > use diagnostics; > my $a="27"; > doit(); > sub doit{ > print "$a\

RE: my, my...

2006-12-15 Thread José Pedro Silva Pinto
functions). Regards Jose Pinto -Original Message- From: Jorge Almeida [mailto:[EMAIL PROTECTED] Sent: sexta-feira, 15 de Dezembro de 2006 10:51 To: beginners@perl.org Subject: my, my... I thought I already knew a few things about Perl, but I just found out I don't: #!/usr/bin/pe

Re: my, my...

2006-12-15 Thread Adriano Ferreira
On 12/15/06, Jorge Almeida <[EMAIL PROTECTED]> wrote: On Fri, 15 Dec 2006, Adriano Ferreira wrote: > > More differences will show up if you use packages. The my() variables > will have the scoping from the point they are declared to the end of But they can be redefined with "my" inside a routin

Re: my, my...

2006-12-15 Thread Adriano Ferreira
On 12/15/06, John W. Krahn <[EMAIL PROTECTED]> wrote: Jorge Almeida wrote: > I thought I already knew a few things about Perl, but I just found out I > don't: > #!/usr/bin/perl -w > use strict; > use diagnostics; > my $a="27"; > doit(); > sub doit{ > print "$a\n";

Re: my, my...

2006-12-15 Thread Jorge Almeida
On Fri, 15 Dec 2006, Jeff Pang wrote: What are you missing?You can write it as your way with no problem usually. But don't do this under mod_perl,otherwise you'll get lost really. You may write them like: use strict; my $ab=27; # don't use $a,$b as variable's name since both $a and $b are u

Re: my, my...

2006-12-15 Thread Jeff Pang
>I thought I already knew a few things about Perl, but I just found out I >don't: > #!/usr/bin/perl -w > use strict; > use diagnostics; > my $a="27"; > doit(); > sub doit{ > print "$a\n"; > } > >The output of this program is: >27 > >Just what

Re: my, my...

2006-12-15 Thread John W. Krahn
Jorge Almeida wrote: > I thought I already knew a few things about Perl, but I just found out I > don't: > #!/usr/bin/perl -w > use strict; > use diagnostics; > my $a="27"; > doit(); > sub doit{ > print "$a\n"; > } > > The output of this program is: > 27 > > Ju

RE: my, my...

2006-12-15 Thread Charles K. Clarkson
Jorge Almeida wrote: : #!/usr/bin/perl -w : use strict; : use diagnostics; : my $a="27"; : doit(); : sub doit{ : print "$a\n"; : } : : The output of this program is: : 27 : : Just what I would expect if line 4 had

my, my...

2006-12-15 Thread Jorge Almeida
I thought I already knew a few things about Perl, but I just found out I don't: #!/usr/bin/perl -w use strict; use diagnostics; my $a="27"; doit(); sub doit{ print "$a\n"; } The output of this program is: 27 Just what I woul

Re: My My

2001-04-23 Thread Andy Sharp
The perl documentation (perldoc -f my) has this to say about the perl builtin "my": A my declares the listed variables to be local (lexically) to the enclosing block, file, or eval. If more than one value is listed, the list must be placed in parentheses. See Private Variables via my()

Re: My My

2001-04-23 Thread Todd A. Jacobs
On Mon, 23 Apr 2001, SunDog wrote: > where 'my' is placed in front of arrays, hashes - you name it ... The "my" keyword makes a variable local. It's a scoping mechanism, and is primarily used inside function definitions to keep the namespace uncluttered. -- Todd A. Jacobs CodeGnome Consult

My My

2001-04-23 Thread SunDog
Hello everyone, I'm new to PERL ... and have a question about a style/format I've observed where 'my' is placed in front of arrays, hashes - you name it ... At first I interpreted this as a Nemonic name but several functions might have this in the same code .. what g