Safety belt
Often programmers make mistakes that are perfecly fine from the language syntax view but have logical issues that create hard detectable bugs.
In order to detect typos and various gotchas Perl provides two very useful pragmas strict
and warnings
.
They are recommended for use in every piece of code.
All the examples in this tutorial imply these two lines,
they are not shown just for the space saving.
You don't have to understand the following code, just see the difference between using safety pragmas
use strict; use warnings; $x += 1; $y .= 'string'; say 'ok';
and not using them
no strict; no warnings; $x += 1; $y .= 'string'; say 'ok';