I have an element in an array that I’d like to move accordingly.
@array = ("a","b","d","e","f","c");
Basically I’d like to find the index of “c” and then place it before “d” again based on “d”‘s index. I’m using these characters as an example. It has nothing to do with sorting alphabetically.
Try doing this using array slice and
List::MoreUtilsto find array elements indexes :See splice()
OUTPUT