I have the following hash:
$data{$meas_name}{$suffix_name}{$corner}{'value'}
Example:
$data{'meas_1'}{'suffix_1'}{'C1'}{'value'} = 10.2 $data{'meas_1'}{'suffix_2'}{'C1'}{'value'} = 4.7 $data{'meas_1'}{'suffix_3'}{'C1'}{'value'} = 5.2 $data{'meas_1'}{'suffix_4'}{'C1'}{'value'} = 11.8 $data{'meas_1'}{'suffix_5'}{'C1'}{'value'} = 0.7
There will be multiple values for the $meas_name field, multiple suffixes for each meas name, and multiple corners. Each corner will have the same number of suffixes for a given meas name. From the above, I would like to create a new hash of arrays with the following structure:
$ordered_hash{$meas_name}{$corner_name} = ("suffix_4", "suffix_1", "su +ffix_3", "suffix_2", "suffix_5")
That is, for each value of meas and corner, the new hash of arrays contains an ordered list of suffixes that correspond to the values in the {'value'} field sorted from smallest to largest. I know how to solve this problem if the original hash was created as $data{$meas_name}{$corner}{$suffix_name}{'value'} rather than $data{$meas_name}{$suffix_name}{$corner}{'value'} - I could simply use 3 foreach loops and a sort command to sort the original hash by the {'value'} field. The problem is that I need the hash to be ordered as it has been created above because I need to print it out in that order at the very end of my script.
In reply to need help sorting a multilevel hash by a particular key by Special_K
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |