John W. Krahn wrote:
Rick wrote:
should this not work?
Based upon the code presented, it looks like the code it correct.
I am finding out that Length is *NOT* being sorted correctly
numerically...
Of course we don't know the data stored in %in_array and %in_array_c
so it is hard to say why it is not working the way you want it.
for my $d ( sort { $in_array{$b} <=> $in_array{$a} } keys %in_array ){
printf "SERVER:%-20s %-20s\n",$d,$in_array{$d};
for my $key30 ( keys %{ $in_array_c{$d} } ) {
for my $key20 ( keys %{ $in_array_c{$d}{$key30} } ) {
for my $key ( sort { $in_array_c{$d}{$key30}{$key20}{$b}
<=> $in_array_c{$d}{$key30}{$key20}{$a} } keys %{
$in_array_c{$d}{$key30}{$key20} } ) {
my $str = substr( ( (split(/_/,$key))[2]),0,12);
print "\tLENGTH:
$in_array_c{$d}{$key30}{$key20}{$key} \n";
}
}
}
}
John
let's say you have a hash reference as below
$has_ref{$a}{$b}{$c}{$d} where a-c represents somethign simple say $a =
'car' $b = 'plane' $c = 'sports' and $d = 'year' and I wanted to sort
by value of year.
I thought above lines will work but it's not being sorted out correctly
and I thought I made some obvious mistakes or perhaps there was better
ways to do this.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/