...
Because Perl programs are typically not explicitly compiled before they are run, they can suffer from typographical errors in variable names. A variable whose name is typed wrongly incorrectly will appear as an undeclared variable to the Perl interpreter , and will therefore contain the undef
value , as opposed to the instead of the value of the intended variable.
...
Perl's -w
command-line option will cause causes a warning to be issued for any variable name in the code that appears exactly once in the code, as this which might indicate a mistyped variable name.
...
Code Block | ||||
---|---|---|---|---|
| ||||
my $result = compute_number();
print "The result is $reuslt\n"; # oops!
|
This causes It causes the program to print the useless output:
Code Block |
---|
The result is
|
and continue execution.
...
Code Block | ||||
---|---|---|---|---|
| ||||
my $result = compute_number();
print "The result is $result\n";
|
...