in reply to switching array entries

You're probably looking for the splice function:

my @array = qw(one two three four five six seven); splice(@array,1,0,$array[4]); # add the item to the new position splice(@array,5,1); # remove it from it's old position (note the moved + index) print "@array"'

There's probably a cool way to do this in one shot.

Update: and there is a cool way to do it! see mce's reply.

-- Dan