That would be my grep method $pc = grep $testvalue eq $HASH{$_}, keys %HASH;
any ideas on how to create reverse hash quick? This returns an odd number of elements: my %BYNAME = map { { "$ALL{$_}" => "$_" } } keys %ALL; > -----Original Message----- > From: Timothy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 20, 2002 5:08 PM > To: 'Nikola Janceski'; Beginners (E-mail) > Subject: RE: Fastest method with a hashes... > > > > The only other thing I can think of that you haven't mentioned is just > cycling through the keys 'till you get one that matches, > which is probably > not the fastest approach, but if memory is a huge issue, it's > probably one > of the most efficient. > > foreach(keys %hash){ > if($hash{$_} = $myvalue){ > print "I've got a flying machine!\n"; > } > } > > -----Original Message----- > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 20, 2002 2:03 PM > To: Beginners (E-mail) > Subject: Fastest method with a hashes... > > > I have a hash as follows: > > PC1 => Nikola Janceski > PC2 => Some Moron > PC3 => Some Other Moron > etc.. > > I want to be able to get the key (PC#) using the value, > what's the fastest > method? > > What I can think of: > a. have a reversed hash of the same info. > b. use that funky module which makes hashes go both ways > c. grep through the values and grab that. > d. Your method here. > > THANX! > > Nikola Janceski > > Nature, to be commanded, must be obeyed. > -- Francis Bacon > > > -------------------------------------------------------------- > -------------- > -------------------- > The views and opinions expressed in this email message are > the sender's > own, and do not necessarily represent the views and opinions of Summit > Systems Inc. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]