Arrays Perl多演示哈希
我如何创建数据并将其添加到哈希%grade\u two中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_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”