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

I am sorry I have no idea what that does. Please explain. My guess is @x[0]=z, @y[0]=y and @z[0]=z.

When I had the below statement, I was trying to create and initialize values of all variables.

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

Please let me know what I'm doing wrong.

Thanks for your help.
  • Comment on Re^6: Referencing in Function not working correctly.

Replies are listed 'Best First'.
Re^7: Referencing in Function not working correctly.
by Your Mother (Archbishop) on Apr 02, 2010 at 20:01 UTC

    :)

    perl -MData::Dumper -lwe 'my ( @x, @y, @z ) = ("z", "y", "z"); print D +umper(\(@x,@y,@z))' $VAR1 = [ 'z', 'y', 'z' ]; $VAR2 = []; $VAR3 = [];
    my (%Aseen, %Bseen, %count, @isec, @diff, @union, @aonly);

    They all are declared empty. No need to be explicit about it; and as the example above shows, that form of being explicit won't do what you might think anyway.

Re^7: Referencing in Function not working correctly.
by jwkrahn (Abbot) on Apr 02, 2010 at 20:03 UTC

    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 );

      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.