好像没有用,并且我已经用了<br>use strict;<br>还需要用<br>use warnings<br>吗?<br><br><div><span class="gmail_quote">2006/8/4, <a href="mailto:jeffhua@aol.com">jeffhua@aol.com</a> &lt;<a href="mailto:jeffhua@aol.com">jeffhua@aol.com</a>&gt;:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">When you run the script with 'use warnings' you could get the errors:<br><br>Modification of a read-only value attempted
<br><br>$1 is a special variable in Perl,you couldn't modify it using the<br>statement of '$1 = ...'.<br><br><br><br><br>-----Original Message-----<br>From: <a href="mailto:panjianfeng1979@gmail.com">panjianfeng1979@gmail.com
</a><br>To: <a href="mailto:china-pm@pm.org">china-pm@pm.org</a><br>Sent: Fri, 4 Aug 2006 5:07 PM<br>Subject:&nbsp;&nbsp;[PerlChina] 请教一个散列表的使用<br><br>my %levelMap = (<br> 'PS_INDETERMINATE' =&gt; 9,<br> 'PS_CRITICAL' =&gt; 1,<br> 'PS_MAJOR' =&gt; 2,
<br> 'PS_MINOR' =&gt; 3,<br> 'PS_WARNING' =&gt; 4<br>);<br>$1 = 'PS_MINOR';<br>但是下面的语句老是报错<br>print $levelMap{$1};<br>提示Use of uninitialized value in print ....<br>请问是怎么回事?谢谢!<br><br>_______________________________________________
<br>China-pm mailing list<br><a href="mailto:China-pm@pm.org">China-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/china-pm">http://mail.pm.org/mailman/listinfo/china-pm</a><br><br>________________________________________________________________________
<br>Check out AOL.com today. Breaking news, video search, pictures, email<br>and IM. All on demand. Always Free.<br>_______________________________________________<br>China-pm mailing list<br><a href="mailto:China-pm@pm.org">
China-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/china-pm">http://mail.pm.org/mailman/listinfo/china-pm</a></blockquote></div><br>