in reply to RE: interchanging variables the tough way
in thread interchanging variables the tough way
OK, this is definitely slower, but you see the point.$a=1,$b=2,$c=3,$d=4,$e=5; &rotate($a, $b, $c, $d, $e); print "\$a=$a,\$b=$b,\$c=$c,\$d=$d,\$e=$e\n"; sub rotate { my $temp = $_[0]; foreach (0..($#_ - 1)) { $_[$_] = $_[$_+1]; } $_[-1] = $temp; }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: (tilly) 2 (possibilities): interchanging variables the tough way
by tilly (Archbishop) on Aug 31, 2000 at 16:08 UTC |