=head2 Safety net
Perl by default is very forgiving. In order to make it more robust
-it is recommened to start every program with the following lines:
+it is recommended to start every program with the following lines:
#!/usr/bin/perl
use strict;
Using C<my> in combination with a C<use strict;> at the top of
your Perl scripts means that the interpreter will pick up certain common
programming errors. For instance, in the example above, the final
-C<print $b> would cause a compile-time error and prevent you from
+C<print $y> would cause a compile-time error and prevent you from
running the program. Using C<strict> is highly recommended.
=head2 Conditional and looping constructs
Exactly like C:
- for ($i=0; $i <= $max; $i++) {
+ for ($i = 0; $i <= $max; $i++) {
...
}
the meantime, here's a quick cheat sheet:
. a single character
- \s a whitespace character (space, tab, newline)
+ \s a whitespace character (space, tab, newline, ...)
\S non-whitespace character
\d a digit (0-9)
\D a non-digit
also available from CPAN.
To learn how to install modules you download from CPAN, read
-L<perlmodinstall>
+L<perlmodinstall>.
To learn how to use a particular module, use C<perldoc I<Module::Name>>.
Typically you will want to C<use I<Module::Name>>, which will then give