Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays Perl多演示哈希_Arrays_Perl_Hash_Multidimensional Array - Fatal编程技术网

Arrays Perl多演示哈希

Arrays Perl多演示哈希,arrays,perl,hash,multidimensional-array,Arrays,Perl,Hash,Multidimensional Array,我如何创建数据并将其添加到哈希%grade\u two中 $grade_two{Student}{Subject}{Test}{Score and edited Score} = (); 我不想硬编码数据。我将通过终端或通过文件读取数据流到变量中 {得分和编辑得分} 应采用一个或多个数组条目(如果有) 我需要使用参考资料吗?或者我可以不用参考? 请给我一个代码的例子,并解释你的答案。多谢各位 使用@{}符号取消对数组的哈希引用。注意 在perl文件的顶部使用use strict是一种很好的做法

我如何创建数据并将其添加到哈希%grade\u two中

$grade_two{Student}{Subject}{Test}{Score and edited Score} = ();
我不想硬编码数据。我将通过终端或通过文件读取数据流到变量中

{得分和编辑得分} 应采用一个或多个数组条目(如果有)

我需要使用参考资料吗?或者我可以不用参考?
请给我一个代码的例子,并解释你的答案。多谢各位

使用@{}符号取消对数组的哈希引用。注意 在perl文件的顶部使用use strict是一种很好的做法,而且会持续很长时间 改进perl编码风格的方法:

试着这样做:

use strict;

my %grade_two;

$grade_two{Student}{Subject}{Test}{'Score and edited Score'} = ();
push(@{$grade_two{Student}{Subject}{Test}{'Score and edited Score'}}, "123");
push(@{$grade_two{Student}{Subject}{Test}{'Score and edited Score'}}, "456");

1;

你能提供一个预期输入流的示例吗?“Joe Ola”“Math”“Quiz1”“98”“ALex R”“Math”“Quiz1”“70”“Ashley Brwown”“英语”测试1”“80”“审查分数86”“Joe Ola”“Math”“Quiz3”“80”“Ashley Brown”“英语”“期中”“95”