“perl"和“perl"之间的区别和“perl -w"? [英] Difference between "perl" and "perl -w"?

查看:80
本文介绍了“perl"和“perl"之间的区别和“perl -w"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 Perl,非常新的用户.我可以知道这些 Perl 代码之间有什么区别吗.

I am learning Perl , very new user . May i know whats the difference between these Perl codes.

#!/usr/bin/perl

&

#!/usr/bin/perl -w

推荐答案

那不是 perl 代码,而是 shebang,它在 linux/unix 环境中用于告诉 shell 应该使用什么程序来运行程序文件.它在 Windows 中不起作用,但它会激活任何使用的开关.

That is not perl code, it's a shebang, which is used in a linux/unix environment as a way to tell the shell what program should be used to run the program file. It has no effect in windows, but it does activate any switches used.

-w 部分是 perl 的一个开关,告诉它激活警告.您可以通过在命令提示符下键入 perl -h 来了解有关 perl 命令行开关的更多信息.在 perldoc perlrun

The -w part is a switch for perl, telling it to activate warnings. You can learn more about perl's command line switches by typing perl -h at the command prompt. Read more in perldoc perlrun

-wuse warnings pragma 的旧版本,现在是首选.-w 是全局的,而 use warnings 是词法的,可以有选择地激活.

-w is the older version of the use warnings pragma, which is preferred nowadays. While -w is global, use warnings is lexical, and can be activated selectively.

这篇关于“perl"和“perl"之间的区别和“perl -w"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆