in reply to Re^6: Referencing in Function not working correctly.
in thread Referencing in Function not working correctly.

When you have an aggregate (array or hash) in a list that variable will be assigned all the values.    So:

my ( @x, @y, @z ) = ("z", "y", "z");

Is exactly the same as:

my @x = ("z", "y", "z"); my ( @y, @z );

Replies are listed 'Best First'.
Re^8: Referencing in Function not working correctly.
by mr_p (Scribe) on Apr 02, 2010 at 20:11 UTC

    So, I don't get what is wrong with me doing

    (%count, @isec, @diff, @union, @aonly) = ();

    to initialize?

      Because @isec, @diff, @union and @aonly will not be effected by that assignment but you seem to think that they will.

        I just put this code through.

        my @x = ("1"); my @y = ("1"); my @z = ("1"); print "Before: @x, @y, @z\n"; (@x, @y, @z) = (); print "After: @x, @y, @z\n";

        and got this output:

        Before: 1, 1, 1 After: , ,

        It initialized all variables.