Perl Programming Question:

How to turn on Perl warnings? Why is that important?

Tweet Share WhatsApp

Answers:

Answer #1Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent searching for bugs and weird results. Turning on warnings helps uncover common mistakes and strange places and save a lot of debugging time in the long run. There are various ways of turning on Perl warnings:

* For Perl one-liner, use -w option on the command line.
* On Unix or Windows, use the -w option in the shebang line (The first # line in the script). Note: Windows Perl interpreter may not require it.
* For other systems, choose compiler warnings, or check compiler documentation.

Answer #2Simply add \\"use warnings\\" at the starting of code.

Download Perl Programming PDF Read All 46 Perl Programming Questions
Previous QuestionNext Question
What happens when you return a reference to a private variable?What are scalar data and scalar variables?