如何使用数组值作为哈希中的键? [英] How to use array values as key in hash ?

查看:113
本文介绍了如何使用数组值作为哈希中的键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

@func是包含名称的数组.我想为每个名称分配值,如下所示,但它确实起作用.

@func is an array containg names. I want to assign values to each name as below, but it does seem to work.

for ($i=0;$i<10; $i++)
{
	$hash{'$func[$i]'}= $i;
	
}
print $hash{'$func[0]'};



我收到如下错误:



I get an error as below:

Use of uninitialized value in print at D:/eclipse/workspace/Pgm1.pl line 47, <FILE1> line 57.



请帮忙.



Please help.

Thanks in advance.

推荐答案

i = 0;


i< 10;
i<10;


i ++) {
i++) {


这篇关于如何使用数组值作为哈希中的键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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