in reply to Array manipulation how to
swap two elements of an array
@array[$index1, $index2] = @array[$index2, $index1];
step $index in direction $dir (+1 or -1) in array in a 'circular' way:
$index = ($index + $dir) % @array; print $array[$index];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array manipulation how to
by jwkrahn (Abbot) on Feb 07, 2012 at 11:07 UTC | |
|
Re^2: Array manipulation how to
by chessgui (Scribe) on Feb 07, 2012 at 09:25 UTC | |
by moritz (Cardinal) on Feb 07, 2012 at 09:47 UTC |