in reply to Re: split hash into two columns
in thread split hash into two columns

Hi.

2 questions for you. I modified this code so I could save all the data.

What is $t ^= 1 doing? I've never seen ^= before.

Secondly, this is resulting in the data being separated from left to right order, not verticle.

10 9 8 7 6 5 4 3
instead of
10 5 9 4 8 3 7 2 6 1
How can I change it? Thanks!

Replies are listed 'Best First'.
Re^3: split hash into two columns
by ikegami (Patriarch) on Mar 27, 2006 at 23:48 UTC

    Oops! Fixed in original node. I also made the code print both the keys and the values.

    $a ^= $b is a shortcut for $a = $a ^ $b. Both operators are documented in perlop. In context, $t ^= 1 causes $t and the return value of the expression to flip-flip between zero and one every time it is executed (assuming $t is originally zero or one).