in reply to changing the position of an element in an array
Finding the position could be done as follows:
my ($pos) = grep { ... } 0..$#array;
where ... checks $array[$_] for the condition.
Once you find the position,
push(@array, splice(@array, $pos, 1))
will do the trick nicely.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: changing the position of an element in an array
by nobull (Friar) on Nov 17, 2005 at 17:48 UTC |