From 0b8d69e96040ec811c067522a2d9770121123a35 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Fri, 4 Feb 2000 07:13:19 +0000 Subject: [PATCH 1/1] pod updates (from David Adler, M J T Guy) p4raw-id: //depot/perl@4979 --- pod/perlfaq2.pod | 2 +- pod/perlop.pod | 2 +- pod/perlsyn.pod | 41 +++++++++++++++++++++++++---------------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/pod/perlfaq2.pod b/pod/perlfaq2.pod index 80b150d..3b0a79f 100644 --- a/pod/perlfaq2.pod +++ b/pod/perlfaq2.pod @@ -344,7 +344,7 @@ following list is I the complete list of CPAN mirrors. Most of the major modules (Tk, CGI, libwww-perl) have their own mailing lists. Consult the documentation that came with the module for -subscription information. Perl Mongers attempts to maintain a +subscription information. The Perl Mongers attempt to maintain a list of mailing lists at: http://www.perl.org/support/online_support.html#mail diff --git a/pod/perlop.pod b/pod/perlop.pod index 68113b7..150813e 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -789,7 +789,7 @@ the trailing delimiter. This avoids expensive run-time recompilations, and is useful when the value you are interpolating won't change over the life of the script. However, mentioning C constitutes a promise that you won't change the variables in the pattern. If you change them, -Perl won't even notice. See also L. +Perl won't even notice. See also L<"qr//">. If the PATTERN evaluates to the empty string, the last I matched regular expression is used instead. diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 1f3ae50..f07bdfe 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -5,21 +5,14 @@ perlsyn - Perl syntax =head1 DESCRIPTION A Perl script consists of a sequence of declarations and statements. -The only things that need to be declared in Perl are report formats -and subroutines. See the sections below for more information on those -declarations. All uninitialized user-created objects are assumed to -start with a C or C<0> value until they are defined by some explicit -operation such as assignment. (Though you can get warnings about the -use of undefined values if you like.) The sequence of statements is -executed just once, unlike in B and B scripts, where the -sequence of statements is executed for each input line. While this means -that you must explicitly loop over the lines of your input file (or -files), it also means you have much more control over which files and -which lines you look at. (Actually, I'm lying--it is possible to do an -implicit loop with either the B<-n> or B<-p> switch. It's just not the -mandatory default like it is in B and B.) - -=head2 Declarations +The sequence of statements is executed just once, unlike in B +and B scripts, where the sequence of statements is executed +for each input line. While this means that you must explicitly +loop over the lines of your input file (or files), it also means +you have much more control over which files and which lines you look at. +(Actually, I'm lying--it is possible to do an implicit loop with +either the B<-n> or B<-p> switch. It's just not the mandatory +default like it is in B and B.) Perl is, for the most part, a free-form language. (The only exception to this is format declarations, for obvious reasons.) Text from a @@ -29,11 +22,27 @@ interpreted either as division or pattern matching, depending on the context, and C++ C comments just look like a null regular expression, so don't do that. +=head2 Declarations + +The only things you need to declare in Perl are report formats +and subroutines--and even undefined subroutines can be handled +through AUTOLOAD. A variable holds the undefined value (C) +until it has been assigned a defined value, which is anything +other than C. When used as a number, C is treated +as C<0>; when used as a string, it is treated the empty string, +C<"">; and when used as a reference that isn't being assigned +to, it is treated as an error. If you enable warnings, you'll +be notified of an uninitialized value whenever you treat C +as a string or a number. Well, usually. Boolean ("don't-care") +contexts and operators such as C<++>, C<-->, C<+=>, C<-=>, and +C<.=> are always exempt from such warnings. + A declaration can be put anywhere a statement can, but has no effect on the execution of the primary sequence of statements--declarations all take effect at compile time. Typically all the declarations are put at the beginning or the end of the script. However, if you're using -lexically-scoped private variables created with C, you'll have to make sure +lexically-scoped private variables created with C, you'll +have to make sure your format or subroutine definition is within the same block scope as the my if you expect to be able to access those private variables. -- 1.8.3.1