in reply to how to sort hash of array by value
my %colorhash = ( CCgray => "0","0","0", CCwhite => "1","0","0", CCgrey => "0","2","0", CCBlue => "0","0","3", );
This isn't what you expect. It is the same as
my %colorhash = ( CCgray => "0", "0" => "0", CCwhite => "1", "0" => "0", CCgrey => "0", "2" => "0", CCBlue => "0", "0" => "3", );
while you surely want
my %colorhash = ( CCgray => [ "0","0","0" ], CCwhite => [ "1","0","0" ], CCgrey => [ "0","2","0" ], CCBlue => [ "0","0","3" ], );
See perlref and perlreftut.
Ah, and another thing: you don't need quotes around your numbers. The above is better written as
my %colorhash = ( CCgray => [ 0, 0, 0 ], CCwhite => [ 1, 0, 0 ], CCgrey => [ 0, 2, 0 ], CCBlue => [ 0, 0, 3 ], );
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|