hi Monks, I need help to sort a hash with keys and values. I am new to perl hashes and would appreciate some help.
I want to sort first by the keys and then values. Here is my hash and what I wrote. I cannot get it sort by values.
$timing1{$related_pin}{$timing_type}{$rise_fall}{$pinname} = $delay; } foreach my $rName ( keys %timing1 ) { foreach my $tType ( sort keys %{$timing1{$rName}}) { foreach my $rF ( sort keys %{$timing1{$rName}{$tType}}){ foreach my $pinName ( keys %{$timing1{$relName}{$tType}{$rF}}) { foreach my $delay(sort {$timing1{$relName}{$timeType}{$rF}{$pinName}{$ +a} <=> $timing1{$rName}{$tType}{$rF}{$pinName}{$b} }keys %timing1){ print OUTFILE2 " $pinName\t $rName\t $tType\t $rF\t $timing1{$rName}{$ +tType}{$rF}{$pinName} \n"; } } } } }
In reply to Sorting Multilevel Hashes by newCoder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |