Sort by any order
From JmPm
@afields is an array of subfields with the subfield name
my %cpr = (a => 1, d => 2, c => 3, l => 4;)
@afields = sort afld @afields;
sub afld{ $cpr{substr($a,2,1)} <=> $cpr{substr($b,2,1)}; };
# Hey folks - is this some ExLibris - specific stuff? It's worth to mention this. Eitan
Eitan, this is indeed ExLibris/ALEPH stuff. For the others, here is an explanation:
The input is $$cCCCCCCC$$aAAAAAAAAa$$lLLLLLL$$dDDDDDD
Where the $$ is a delimiter and the letter after it is the code of the sub-field.
The idea is to sort the sub-fields, but not nessecarily in alphabetical order.
In the example above, the order should be a,d,c,l.