From:                   sfritz <[EMAIL PROTECTED]>

> having two
> 
> my $name = "Sean Fritz";
> my $name = "Sean W. Fritz"; #functions as the shown assignment
> statment,
> 
> just functions as an assignment statment (I believe) and dosen't
> alocate any memory or destroy the previous variable.  I could be very
> wrong on that part though.

Try this script :

        #!perl
        my $x = 5;
        $r = \$x;
        print "REF: $r\n";
        my $x = $x;
        $r = \$x;
        print "REF: $r\n";
        __END__


You can see that the second my() does create a new variable ... 
and masks the previous one.

> I do know that
> 
> my $a = $a;           #refrences whatever was the scoped $a before
> 
> will refrence whatever $a was prior to you creating that global var. 

It will get a copy, not reference the original value :

        my $x = 'Hello World';
        $r1 = \$x;
        my $x = $x;
        print "Orig: $$r1\nNew: $x\n\n";
        $x = 'Hi dude';
        print "Orig: $$r1\nNew: $x\n\n";

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