有什么不一样啊,能具体说下么
2009/8/31 xiaohuidexinge <[email protected]> > 把第一行的 -w 去掉就好了 > -w的作用范围和use warnings 不一样 > > > > > -- > <http://minisite.163.com/2009/0715/vichy/> > > 在2009-08-31,"Haiyan Lin" <[email protected]> 写道: > > 再笨笨的问一下。在楼顶的例子中,除了不用“#! /usr/bin/perl > -w",或将其移到第二行让其失效外。还有没有其他的办法。我觉得上面提到的方法不好! > > ----- Original Message ----- > *From:* joe jiang <[email protected]> > *To:* [email protected] > *Sent:* Sunday, August 30, 2009 9:07 PM > *Subject:* [PerlChina] Re: 请教IO::Prompt 的问题 > > 应该避免警告,但是这个警告应该是 perl 自身的 bug 导致的,因为第 91 行并非正则运算,和警告信息是不符合的。 > > 91 if (ref eq 'HASH') { > > > 2009/8/30 Michael Zeng <[email protected]> > >> #!/usr/local/bin/perl -w 放在第一行 是一个习惯 >> 叫shubang 行,让shell 去了解你的运行 程序的 >> >> 如果在命令行打perl , 不要这行也可以 >> >> shell>perl XXXX.pl >> >> -w 是开启warning 的意思 >> >> 和 use warnings ; 一样的 >> >> >> >> >> 2009/8/30 Haiyan Lin <[email protected]> >> >> 谢谢joe的回答。这对于脚本运行。会有什么影响吗? >>> >>> ----- Original Message ----- >>> *From:* joe jiang <[email protected]> >>> *To:* [email protected] >>> *Sent:* Sunday, August 30, 2009 7:55 PM >>> *Subject:* [PerlChina] Re: 请教IO::Prompt 的问题 >>> >>> 因为在第二行,#! 所有的魔力就失效了,变成了一个无用的注释。 >>> >>> 2009/8/30 linhy <[email protected]> >>> >>>> 再用IO::Prompt的时候,碰到一个很费解的问题?脚本的第一行是"#! /usr/bin/perl -w“的时候。尽管脚本可以运行, 会给 >>>> 出警告信息: >>>> >>>> Use of uninitialized value $_ in pattern match (m//) at /usr/local/ >>>> lib/perl5/site_perl/5.10.0/IO/Prompt.pm line 91. >>>> >>>> 若将第一行空着,把"#! /usr/bin/perl -w“放到第二行的时候,警告信息就消失了。不知道为什么?兄弟姐妹们碰到过吗?请指点一下。 >>>> 详细情况如下: >>>> >>>> >>>> [li...@genome2 Practice]$ cat -n iotry2.pl >>>> 1 #! /usr/bin/perl -w >>>> 2 # >>>> 3 use strict; >>>> 4 use warnings; >>>> 5 use IO::Prompt; >>>> 6 >>>> 7 prompt ("print paswd: " , -tty, -echo => '*') or die "Error: >>>> $!"; >>>> 8 >>>> 9 print "You passwd is: '$_'\n"; >>>> 10 >>>> 11 exit ; >>>> >>>> [li...@genome2 Practice]$ perl iotry2.pl >>>> Use of uninitialized value $_ in pattern match (m//) at /usr/local/lib/ >>>> perl5/site_perl/5.10.0/IO/Prompt.pm line 91. >>>> print paswd: ** >>>> You passwd is: 'll' >>>> >>>> 若将第一行空着,把"#! /usr/bin/perl -w“放到第二行的时候,警告信息就消失了。 >>>> [li...@genome2 Practice]$ cat -n iotry3.pl >>>> 1 >>>> 2 #! /usr/bin/perl -w >>>> 3 # >>>> 4 use strict; >>>> 5 use warnings; >>>> 6 use IO::Prompt; >>>> 7 >>>> 8 prompt ("print paswd: " , -tty, -echo => '*') or die "Error: >>>> $!"; >>>> 9 >>>> 10 print "You passwd is: '$_'\n"; >>>> 11 >>>> 12 exit ; >>>> [li...@genome2 Practice]$ perl iotry3.pl >>>> print paswd: *** >>>> You passwd is: 'lll' >>>> >>>> >>>> >>> >> >> >> -- >> Yours Sincerely >> Zeng Hong >> >> >> > > > 没有广告的终身免费邮箱,www.yeah.net <http://www.yeah.net/?from=footer>> > -- Yours Sincerely Zeng Hong --~--~---------~--~----~------------~-------~--~----~ 您收到此信息是由于您订阅了 Google 论坛“PerlChina Mongers 讨论组”论坛。 要在此论坛发帖,请发电子邮件到 [email protected] 要退订此论坛,请发邮件至 [email protected] 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛 -~----------~----~----~----~------~----~------~--~---
