The difference between "perl" and "perl -w"?

I am learning Perl, a very new user. May I find out what is the difference between these Perl codes.

#!/usr/bin/perl 

&

 #!/usr/bin/perl -w 
+6
source share
1 answer

This is not perl code, it is shebang , which is used in linux / unix environment as a way to tell the shell which program should be used to run the program file. It does not work in windows, but activates any keys used.

The -w part is a switch for perl telling it to activate warnings. You can learn more about perl command line options by typing perl -h at the command line. More at perldoc perlrun

-w is an earlier version of the use warnings , which is currently preferred. As long as -w is global, use warnings is lexical and can be activated selectively.

+11
source

Source: https://habr.com/ru/post/926054/


All Articles