这脚本写的不太对吧
和
@sorted_scripts
=do {
sort { sha512($a) )
cmp
sha512($b) )
}
@scripts;
}
有什么区别 ?
my %sha512_of; 是新定义的啊, 和没有一样
2009/9/17 钟声 <[email protected]>
> @sorted_scripts
> =do {
> my %sha512_of;
> sort { ($sha512_of{$a} ||= sha512($a) )
> cmp
> ($sha512_of{$b} ||= sha512($b) )
>
> }
> @scripts;
>
> }
> 书上说不要在sort中重新计算排序键。刚看到 ||= 这个符号我半天没反应过来
> 虽然搞懂是什么意思了,但总不像 += 和 --=那么容易接受。大家也都经常这样用吗?
>
> >
>
--
Yours Sincerely
Zeng Hong
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 [email protected]
要退订此论坛,请发邮件至 [email protected]
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---