@height = (10,20,30,31,32,33); @weight = (19,18,17,16,15,14); for( (map{$_->[1]} sort{$b->[0] <=> $a->[0]} map{[$height[$_]*$weight[$_],$_]} (0..$#height))[0,1] ){ print "$_:$height[$_],$weight[$_]\n"; }