http://qs321.pair.com?node_id=1159522


in reply to jbrowseentry using hashref does not seem to work

Kafka,

I was hoping a monk with "Tk::JBrowseEntry" experience would give you some help, since I never worked with it, and only played with "Tk" a few times. That said, after you build your '%color_of' hash you could build another hash with the values of '%color_of' as the keys. ie: Untested!

my %color_of = ( "apple" => "red", "orange" => "orange", "grape" => "purple", ); my %rev_color = (); foreach my $key ( keys %color_of ) { $rev_color{ $color_of{ $key } } = $key; }

This allows you to lookup '$value' by using the contents of '$var' as the key for your '%rev_color' hash. ie:

print "Var = $var, Get Result $rev_color{ $var }\n";

Note: you can't have duplicate keys in the new hash.

It may not be perfect, but it's a way of getting your desired results.

Regards...Ed

"Well done is better than well said." - Benjamin Franklin