在哈希搜索 [英] Searching in Hashes

查看:65
本文介绍了在哈希搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序中有一个哈希。

问题是我需要在哈希中搜索,但有一些键是相同的,但我需要得到所有这些的相关值当我做一些像


$ value = $ hash {" theKey"显然我只得到与名为theKey的第一个键相关联的值。$; b $ b。我怎样才能得到其他人?某种循环?


谢谢

There is a hash in my program.
The problem is I need to search in the hash, but there are some keys that are identical, but I need to get the associated value of all these keys.

when I do something like

$value = $hash{ "theKey" };

obviously I''m only getting the value associated to the first key called "theKey". How can I get the others? Some sort of loop?

thanks

推荐答案

value =


hash { " theKey"显然我只得到与名为theKey的第一个键相关联的值。$; b $ b。我怎样才能得到其他人?某种循环?


谢谢
hash{ "theKey" };

obviously I''m only getting the value associated to the first key called "theKey". How can I get the others? Some sort of loop?

thanks


哈希不能有相同的键。每把钥匙都必须是独一无二的。您使用散列哈希值还是散列数组?
Hashes can not have identical keys. Each key has to be unique. Are you using a hash of hashes or array of hashes?


这篇关于在哈希搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆