[PerlChina] 请教一个散列表的使用

潘建锋 panjianfeng1979 at gmail.com
Fri Aug 4 02:15:03 PDT 2006


搞定了,是一个低级错误,把%map的声明写到了子程序调用的下面 ,谢谢了。

2006/8/4, fayland <fayland at gmail.com>:
>
> 潘建锋 wrote:
> > my %levelMap = (
> > 'PS_INDETERMINATE' => 9,
> > 'PS_CRITICAL' => 1,
> > 'PS_MAJOR' => 2,
> > 'PS_MINOR' => 3,
> > 'PS_WARNING' => 4
> > );
> > $1 = 'PS_MINOR';
> > 但是下面的语句老是报错
> > print $levelMap{$1};
> > 提示Use of uninitialized value in print ....
> > 请问是怎么回事?谢谢!
>
> $a = 'PS_MINOR';
>
> print $levelMap{$a};
>
> $1 是给 Regex 用的。好象是只读的。
>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > China-pm mailing list
> > China-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/china-pm
>
>
> --
> Fayland Lam // http://www.fayland.org/
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20060804/d4926059/attachment.html 


More information about the China-pm mailing list