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

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

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

    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.

        Ok. Thanks for clearing things up. I was thinking they are trying to tell me something else.