如何使用数组值作为哈希中的键?

问题描述:

@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++) {