From: "Jason Frisvold" <[EMAIL PROTECTED]>
> Ok, shoot me now...  I tried to provide an example and I blew it..
> *grin*  I realize that the locals are block scope..  I know what I
> meant, just didn't say it..  :)

I see. You never know where does the other guy come from. In VB 
(yes I am forced to use THAT) the scope is either whole subroutine 
or whole file or whole application. Aaaaaggggrrrrrr.
 
> I understand that you cannot access a local variable outside it's
> scope..  Hrm.. ok, try this :
> 
> sub dummy {
>  my $a;
>  if ($b == 1) { $a = 2; }
>  print "$a\n";
> }
> 
> Now..  If $b is 1, then $a gets set to 2 and everything is great.
> However, if not, $a stays unintialized (which I believe is null) and I
> get that 'uninitialized value' error...
> 
> I think I'm answering my own question, though...  always initialize
> the variable and stupid stuff like this won't happen...

Yes, you can do it that way. What I ended up doing though is start 
my scripts&modules with

        use strict;
        use warnings;
        no warnings 'uninitialized';

cause I simply hate that warning. Having to write stuff like:

        if (defined $foo and $foo)

Nay thanks.

Jenda

=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
                                        --- me

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

Reply via email to