Is there a way that I can sort an array based on a sub-string of the array element. For example, lets say I have the following array:
@myArray = qw("AAA|111|bbb" "CCC|333|ddd" "EEE|444|fff" "GGG|222|hhh");
I want to sort this array based on the sub-string starting at position 4 (zero-based) for a length of 3 (in the first array element in my example, that would be "111").
The length of each array element will always be the same for all elements and the sub-string I want to sort on will always be in the same position for the same length in the array element.
This is what my sorted output would look like:
AAA|111|bbb
GGG|222|hhh
CCC|333|ddd
EEE|444|fff
Also, while I am showing numbers as the sub-string in my example, it could be non-number values in there too. So the sort would have to work for non-numbers too.