Chinaunix
标题:
关于 数据结构的问题 请教
[打印本页]
作者:
dgtnk
时间:
2011-03-11 16:05
标题:
关于 数据结构的问题 请教
有个文件格式(内容不便显示,我都换成了**,大家见谅哈)如下:
ID info1 info2 info3 info4
** ** ** ** **
** ** ** ** **
......
复制代码
文件说明:
1. ID一列是独一无二的
2. info1 info2 info3 info4各列内容在其它行都有可能重复出现
3. info1 info2 三项内容的组合是独一无二的
对文件的操作:
根据提供的info1 和 info2的信息,输出 info3 和 info4
我的数据结构是这样的:
%a, %b, %c
$a{id}=[info1,info2]
$b{id}=info3
$c{id}=info4
得到提供的info1 和 info2的信息后,通过 %a 得到 id
然后再根据 id 通过 %b 和 %c 输出 info3 和 info4
本人perl菜鸟,对数据结构理解就到这了,所以请教一下板上各位还有没有更好的办法。。。。。
作者:
zhlong8
时间:
2011-03-11 16:47
$hash{$info1, $info2} = [$ID, $info3, $info4]
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2