但是 我现在因为要跨平台,一般不知道 perl 在什么地方,

#!/usr/local/bin/perl 不写行么,  就单独写个 #! -w ?

我一般都是在shell>perl  XXX.pl




2009/9/3 Haiyan Lin <[email protected]>

>  学习了。谢谢。
>
> ----- Original Message -----
> *From:* xiaohuidexinge
> *To:* perlchina
> *Sent:* Tuesday, September 01, 2009 9:17 AM
> *Subject:* [PerlChina] Re: 请教IO::Prompt 的问题
>
> use warnings;只作用于你当前的文件 更准确的说是当前的block
> -w 作用于所有你require ,use的代码,不仅是你自己写的东西的警告,你用的别的代码里有问题 他也会报警告。
>
> 所以如果你只用 use warnings  IO::Prompt里的警告就不会出现了
>
>
>
>
> 在2009-08-31,"Qiang (James)" <[email protected]> 写道:
> >
> >Michael Zeng wrote:
> >> 有什么不一样啊,能具体说下么
> >
> >-w 和 use warnings 经常在一起使用。或者单使用 use warnings 即可。
> >
> >至于两者的区别你可以阅读 perllexwarn (perldoc perllexwarn)
> >
> >Qiang
> >
> >>
> >>
> >>
> >> 2009/8/31 xiaohuidexinge <[email protected]
> >> <mailto:[email protected]>>
> >>
> >>     把第一行的 -w 去掉就好了
> >>     -w的作用范围和use warnings 不一样
> >>
> >>
> >>
> >>
> >>     --
> >>     <http://minisite.163.com/2009/0715/vichy/>
> >>
> >>     在2009-08-31,"Haiyan Lin" <[email protected]
> >>     <mailto:[email protected]>> 写道:
> >>
> >>         再笨笨的问一下。在楼顶的例子中,除了不用“#! /usr/bin/perl -w",
> >>         或将其移到第二行让其失效外。还有没有其他的办法。我觉得上面提到的
> >>         方法不好!
> >>
> >>             ----- Original Message -----
> >>             *From:* joe jiang <mailto:[email protected]>
> >>             *To:* [email protected]
> >>             <mailto:[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]
> >>             <mailto:[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]
> >>                 <mailto:[email protected]>>
> >>
> >>                     谢谢joe的回答。这对于脚本运行。会有什么影响吗?
> >>
> >>                         ----- Original Message -----
> >>                         *From:* joe jiang <mailto:[email protected]>
> >>                         *To:* [email protected]
> >>                         <mailto:[email protected]>
> >>                         *Sent:* Sunday, August 30, 2009 7:55 PM
> >>                         *Subject:* [PerlChina] Re: 请教IO::Prompt 的问题
> >>
> >>                         因为在第二行,#! 所有的魔力就失效了,变成了一个
> >>                         无用的注释。
> >>
> >>                         2009/8/30 linhy <[email protected]
> >>                         <mailto:[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
> >>
> >> >
> >
> >
> >>
>
>
>
> ------------------------------
> 没有广告的终身免费邮箱,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 访问该论坛
-~----------~----~----~----~------~----~------~--~---

回复