I have a hash. The hash key is a long string, "str_3432_123_A12_C02_xy_ut", and I want to sort the keys by a subset of the string which will have the format A12_C02.
I assume no other part of the string will match the regex, but the location inside the string can differ.
[A-Za-z][0-9]{2}_[A-Za-z][0-9]{2}
To sort my hash by keys:
my @sorted = sort keys %myhash;
I also have a separate array for all the values that could possibly match.