Re: using 'my' problem

2004-11-06 Thread John W. Krahn
Zeus Odin wrote: Apologies, I was asleep at the wheel during my last response. :-) The only answer I have is that this is how the designers of Perl decided that the printing of undefined $, @, and % would work. This is probably due to the fact that the undefined value of a scalar *is* different fro

Re: using 'my' problem

2004-11-06 Thread JupiterHost.Net
Zeus Odin wrote: Apologies, I was asleep at the wheel during my last response. :-) The only answer I have is that this is how the designers of Perl decided that the printing of undefined $, @, and % would work. This is probably due to the fact that the undefined value of a scalar *is* different fr

Re: using 'my' problem

2004-11-06 Thread Zeus Odin
Two small mistakes: "Zeus Odin" <[EMAIL PROTECTED]> wrote in message ... > $ perl -mstrict -MData::Dumper -we "my $; print Dumper $s;" ^^^ $s > $VAR1 = undef; > $ perl -mstrict -MData::Dumper -we "my %h; print Dumpe

Re: using 'my' problem

2004-11-06 Thread Zeus Odin
Apologies, I was asleep at the wheel during my last response. :-) The only answer I have is that this is how the designers of Perl decided that the printing of undefined $, @, and % would work. This is probably due to the fact that the undefined value of a scalar *is* different from the undefined

Re: using 'my' problem

2004-11-03 Thread JupiterHost.Net
Zeus Odin wrote: To see the code that is actually getting compiled, try: $ perl -MO=Deparse -mstrict -we 'my @foo;print @foo;' Ok, not sure what that has to do with @ and % not getting uninitialized warnings and $ getting them... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Re: using 'my' problem

2004-11-03 Thread Zeus Odin
To see the code that is actually getting compiled, try: $ perl -MO=Deparse -mstrict -we 'my @foo;print @foo;' "JupiterHost.Net" <[EMAIL PROTECTED]> wrote in message ... > Correct, except I still think @ ans % don't get uninitialized value > warnings while $ does: > > $perl -mstrict -we 'my $foo

Re: using 'my' problem

2004-11-03 Thread JupiterHost.Net
Zeus Odin wrote: The reason why you don't get the uninitialized warning in the 2nd and 3rd examples below is that your print is within the for loop. Since both @files and keys %files contain nothing, the innards of the for loop NEVER get executed. Therefore, the print is not attempted at all for e

Re: using 'my' problem

2004-10-31 Thread Zeus Odin
The reason why you don't get the uninitialized warning in the 2nd and 3rd examples below is that your print is within the for loop. Since both @files and keys %files contain nothing, the innards of the for loop NEVER get executed. Therefore, the print is not attempted at all for examples 2 and 3.

Re: using 'my' problem

2004-10-27 Thread John W. Krahn
Murphy, Ged (Bolton) wrote: In order to use the array @files in the below code outside of the subroutine, so I need to declare @files globally? You could but it is not really necessary. I'm getting errors at the moment: Global symbol "@files" requires explicit package name That is because you have

Re: using 'my' problem

2004-10-27 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: I've noticed that some prefer @files = () for clarity, ... Sorry, should have been I've noticed that some prefer my @files = () for clarity, ... -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: using 'my' problem

2004-10-27 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: So scratch what I said, what Gunnar said is better. my @files; is what you want, as my @files = (); is basically pointless ;p Now I think you are too hard to yourself. :) I've noticed that some prefer @files = () for clarity, so it may not be totally pointless. At the same

Re: using 'my' problem

2004-10-27 Thread JupiterHost.Net
JupiterHost.Net wrote: Gunnar Hjalmarsson wrote: JupiterHost.Net wrote: I'd say reight before opendir() my @files = (); Which is equivalent to my @files; since my() has the side-effect of clearing the declared variable. Except = (); will help avoid "uninitialized value" warnings no? That w

Re: using 'my' problem

2004-10-27 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: Gunnar Hjalmarsson wrote: JupiterHost.Net wrote: my @files = (); Which is equivalent to my @files; since my() has the side-effect of clearing the declared variable. Except = (); will help avoid "uninitialized value" warnings no? How? use warnings; my @files = ();

Re: using 'my' problem

2004-10-27 Thread JupiterHost.Net
Gunnar Hjalmarsson wrote: JupiterHost.Net wrote: I'd say reight before opendir() my @files = (); Which is equivalent to my @files; since my() has the side-effect of clearing the declared variable. Except = (); will help avoid "uninitialized value" warnings no? -- To unsubscribe, e-mail: [EMA

Re: using 'my' problem

2004-10-27 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: I'd say reight before opendir() my @files = (); Which is equivalent to my @files; since my() has the side-effect of clearing the declared variable. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

Re: using 'my' problem

2004-10-27 Thread JupiterHost.Net
Murphy, Ged (Bolton) wrote: In order to use the array @files in the below code outside of the subroutine, so I need to declare @files globally? I'm getting errors at the moment: Global symbol "@files" requires explicit package name If so, where is the correct place to declare them in terms of ne

RE: using 'my' problem

2004-10-27 Thread Thomas Bätzler
Murphy, Ged (Bolton) asked: > In order to use the array @files in the below code outside of > the subroutine, so I need to declare @files globally? > I'm getting errors at the moment: Global symbol "@files" > requires explicit package name > > If so, where is the correct place to declare them in