in reply to RE: simple swap...
in thread simple swap...

Your array slicing is unfair, since you create the array beforehand.

$_="goto+F.print+chop;\n=yhpaj";F1:eval

Replies are listed 'Best First'.
RE:(3) simple swap...
by Russ (Deacon) on Jul 22, 2000 at 01:28 UTC
    I'm not sure I understand what you mean. The variables being swapped are created beforehand in both methods. In the first examples, they are separate variables. In my second example, they are members of an array. Each of the subs swap the values in two variables.

    I mainly included them to point out:

    • TMTOWTDI
    • My benchmarks show arrays are even slower than the lists in the first example.
    :-)

    Russ
    Brainbench 'Most Valuable Professional' for Perl

      I was saying that if you were using them as examples of putting the variables in the array and swapping them, well, for one, that doesn't switch the variables, just the elements of the array; and two, your test should've included the process of forming the array. But nevermind.

      $_="goto+F.print+chop;\n=yhpaj";F1:eval