in reply to Re: Re: swapping vars, two ways, 2 results...
in thread swapping vars, two ways, 2 results...

If performance isn't a concern I use list assignment, if it is, I'd use the XOR method.
Besides being obfuscatory, the XOR method only works on numbers or strings. It doesn't work on other things, like references and filehandles. The perlish method works on anything.

jdporter
...porque es dificil estar guapo y blanco.

  • Comment on Re: Re: Re: swapping vars, two ways, 2 results...

Replies are listed 'Best First'.
Re: Re: Re: Re: swapping vars, two ways, 2 results...
by BrowserUk (Patriarch) on Dec 19, 2002 at 04:39 UTC

    Good point on the non-scalars though the OP was talking about ... 2 big vars my $a = "10"x10000; ....

    If I was dealing with non-scalars and performance was critical, I'd use the temp var.

    ... Besides being obfuscatory, the XOR method ...

    Do you really find it confusing?


    Examine what is said, not who speaks.