SPUG: Re: scalar swap challenge (SPOILER!)

Creede Lambard creede at penguinsinthenight.com
Wed Oct 8 20:40:36 CDT 2003


On Wed, Oct 08, 2003 at 04:55:17PM -0700, ced at carios2.ca.boeing.com wrote:
> 
>   push @ARGV,$y,$x;
>   ($y,$x)=(pop,pop); 
> 

Shouldn't that be

push @_, $y, $x; ($y, $x) = (pop, pop);

?

You could also do

$ENV{FOO} = $x;
$ENV{BAR} = $y;
$y = $ENV{FOO};
$x = $ENV{BAR};

and then start an argument over whether environment variables count as
scalars. :)

(I know, that's pushing it big time)

A mail from Michael a few minutes ago informed me that he was trying to
eschew temporary storage of any kind, so I'm trying to think outside that
particular box.





More information about the spug-list mailing list