Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: jbrowseentry using hashref does not seem to work

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


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1159522]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-09-19 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (114 votes). Check out past polls.

    Notices?