2009年2月14日星期六

[PerlChina] Re: 询问关于自动生成hash

2009/2/15 allen <allenogz@gmail.com>:
> 那我定义一下格式: $num $name $value
> 从某一个文件中获得这3个值
> 然后根据$num的多少自动生成相应的hash
> 比如 2 张三 5
> 生成 的hash 为 hash_2 其中的key 张三 对应的值为5
> 再比如 4 李四 6 生成的hash 为hash_4 其中的key 李四 对应的值为6
>

重新设计你的数据结构吧,例如说用一个 hash 引用的数组代替你的 hash_1, hash_2, ...

lee

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

没有评论: