Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: jbrowseentry using hashref does not seem to work

by flexvault (Monsignor)
on Apr 04, 2016 at 17:31 UTC ( [id://1159522] : note . print w/replies, xml ) Need Help??

in reply to jbrowseentry using hashref does not seem to work


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.


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