亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1708 | 回復(fù): 3
打印 上一主題 下一主題

hash 的一點(diǎn)問題 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2011-02-14 11:25 |只看該作者 |倒序?yàn)g覽
  1. [root@localhost ~]# perl -e '%a=(a,aa,b,bb,c,cc,d,dd,e,ee);$b=%a;print $b,"\n"'
  2. 5/8
  3. [root@localhost ~]# perl -e '%a=(a,aa,b,bb,c,cc,d,dd,e,ee,f,ff);$b=%a;print $b,"\n"'
  4. 6/8
  5. [root@localhost ~]# perl -e '%a=(a,aa,b,bb,c,cc,d,dd,e,ee,f,ff,g,gg);$b=%a;print $b,"\n"'
  6. 6/8
復(fù)制代碼
為啥后面2個(gè)是一樣的,明顯多了一個(gè)。
問了幾個(gè)人都說詭異。

論壇徽章:
1
2015年辭舊歲徽章
日期:2015-03-03 16:54:15
2 [報(bào)告]
發(fā)表于 2011-02-14 12:15 |只看該作者
502 只住兩個(gè)人,602 合租住了 8 個(gè)人,房子面積居然是一樣的。詭異。后來 602 又搬走了 2 個(gè)人,只剩下 6 個(gè)人,面積居然沒有減少!詭異!

論壇徽章:
46
15-16賽季CBA聯(lián)賽之四川
日期:2018-03-27 11:59:132015年亞洲杯之沙特阿拉伯
日期:2015-04-11 17:31:45天蝎座
日期:2015-03-25 16:56:49雙魚座
日期:2015-03-25 16:56:30摩羯座
日期:2015-03-25 16:56:09巳蛇
日期:2015-03-25 16:55:30卯兔
日期:2015-03-25 16:54:29子鼠
日期:2015-03-25 16:53:59申猴
日期:2015-03-25 16:53:29寅虎
日期:2015-03-25 16:52:29羊年新春福章
日期:2015-03-25 16:51:212015亞冠之布里斯班獅吼
日期:2015-07-13 10:44:56
3 [報(bào)告]
發(fā)表于 2011-02-14 12:49 |只看該作者
明顯 'g' 和別人同房了

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2011-02-14 13:08 |只看該作者
回復(fù) 1# minmig


   
http://perldoc.perl.org/perldata.html#Scalar-values

If you evaluate a hash in scalar context, it returns falseif the hash is empty. If there are any key/value pairs, it returns true; moreprecisely, the value returned is a string consisting of the number of usedbuckets and the number of allocated buckets, separated by a slash. This ispretty much useful only to find out whether Perl's internal hashing algorithmis performing poorly on your data set. For example, you stick 10,000 things ina hash, but evaluating %HASH in scalar context reveals "1/16", which means only one out of sixteen buckets has beentouched, and presumably contains all 10,000 of your items. This isn't supposedto happen. If a tied hash is evaluated in scalar context, a fatal error willresult, since this bucket usage information is currently not available for tiedhashes.

You can preallocate space for a hash by assigning to thekeys() function. This rounds up the allocated buckets to the next power of two:

1.      keys(%users)= 1000;        # allocate 1024 buckets



Also refer to <<Professional Perl Programming>> Page 137
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP