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

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

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

to initialize?

Replies are listed 'Best First'.
Re^9: Referencing in Function not working correctly.
by jwkrahn (Abbot) on Apr 02, 2010 at 20:15 UTC

    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.

        It initialized all variables.

        Yes, but that's completely different than what people are trying to tell you. If you write:

        my @x;

        ... @x contains the same thing as if you had written:

        my @x = ();

        ... because @x will contain no elements. People are trying to tell you not to waste time and keystrokes with the latter, because it's unnecessary and a distraction.