-- Start
Perl is a very loose language. By default, we use an undefined variable or perform mathematical operations on a string and a number. It does not report any errors, so when we write a Perl script, we 'd better use one of the following methods for debugging.
#! /Usr/bin/perl # method 1 -- modify the sandband and add the-W option #! /Usr/bin/perl-W # method 2 -- add the warnings compilation command # Use warnings; # method 3 -- add the diagnostics compilation command to display details # Use diagnostics; $ num1 = "test"; $ num2 = 3; print ($ num1 * $ num2 );
The disadvantage of the above three methods is that after we debug the script, we must manually delete these Debugging commands, otherwise it will affect the performance. The following two methods provide great flexibility by adding command line parameters.
# Add the-W option and provide a simple error message Perl-W test. pl # Add the diagnostics compilation command and provide detailed error information Perl-mdiagnostics test. pl
-- For more information, see Perl.
--Shengming: reprinted, please indicate the source
-- Last updated on 2012-06-11
-- Written by shangbo on 2012-06-11
-- End