I am learning Perl , very new user . May i know whats the difference between these Perl codes.
#!/usr/bin/perl
&
#!/usr/bin/perl -w
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.
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
-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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With