关于hash的疑问

关于hash的疑问

#!/bin/perl

%seen = ();
$string = "an apple a day";
while ($string =~ /(.)/g) {
$seen{$1}++;
print "information [", keys %seen,"]\n";
print "information [", values %seen,"]\n";
}
print "unique chars are: ", keys %seen, "\n";
print "unique chars are: ", values %seen, "\n";

这个脚本运行结果是
information [a]
information [1]
information [na]
information [11]
information [n a]
information [111]
information [n a]
information [112]
information [pn a]
information [1112]
information [pn a]
information [2112]
information [lpn a]
information [12112]
information [elpn a]
information [112112]
information [elpn a]
information [112122]
information [elpn a]
information [112123]
information [elpn a]
information [112133]
information [elpn ad]
information [1121331]
information [elpn ad]
information [1121341]
information [en adlyp]
information [11341112]
unique chars are: en adlyp
unique chars are: 11341112

我不明白的是%seen = ();定义了一个空的hash
while ($string =~ /(.)/g) {
$seen{$1}++;
找到单个字符,然后把这个字符作为hash的键值给seen,然后对于的值就加1,那%seen = ();做的初始化是空还是0啊? 如果是空的话,空加1不应该等于1吧  
%seen = ();是指每个值都是0麽? 谢谢


QUOTE:
空加1不应该等于1吧

是就是是,不是就是不是,不要“应该”“不应该”的,
基础一定要打牢固,这样看程序写程序时才不会迷惑。
哦  知道了! 那版主能帮忙解答一下麽? 谢谢
我自己做了实验,空加1是等于1。 多谢版主大驾光临,解答问题。  感谢得眼泪哗啦哗啦的。