summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/pods/perlintro.pod
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl/lib/pods/perlintro.pod')
-rw-r--r--Master/tlpkg/tlperl/lib/pods/perlintro.pod31
1 files changed, 17 insertions, 14 deletions
diff --git a/Master/tlpkg/tlperl/lib/pods/perlintro.pod b/Master/tlpkg/tlperl/lib/pods/perlintro.pod
index 2d0076a029d..afce360a2ac 100644
--- a/Master/tlpkg/tlperl/lib/pods/perlintro.pod
+++ b/Master/tlpkg/tlperl/lib/pods/perlintro.pod
@@ -35,10 +35,10 @@ already been declared, even if those declarations have been omitted
to make the example easier to read.
Do note that the examples have been written by many different authors over
-a period of several decades. Styles and techniques will therefore differ,
+a period of several decades. Styles and techniques will therefore differ,
although some effort has been made to not vary styles too widely in the
-same sections. Do not consider one style to be better than others - "There
-Is More Than One Way Of Doing It" is one Perl's mottos. After all, in your
+same sections. Do not consider one style to be better than others - "There's
+More Than One Way To Do It" is one of Perl's mottos. After all, in your
journey as a programmer, you are likely to encounter different styles.
=head2 What is Perl?
@@ -73,7 +73,7 @@ Alternatively, put this as the first line of your script:
... and run the script as C</path/to/script.pl>. Of course, it'll need
to be executable first, so C<chmod 755 script.pl> (under Unix).
-(This start line assumes you have the B<env> program. You can also put
+(This start line assumes you have the B<env> program. You can also put
directly the path to your perl executable, like in C<#!/usr/bin/perl>).
For more information, including instructions for other platforms such as
@@ -81,7 +81,7 @@ Windows and Mac OS, read L<perlrun>.
=head2 Safety net
-Perl by default is very forgiving. In order to make it more robust
+Perl by default is very forgiving. In order to make it more robust
it is recommended to start every program with the following lines:
#!/usr/bin/perl
@@ -89,7 +89,7 @@ it is recommended to start every program with the following lines:
use warnings;
The two additional lines request from perl to catch various common
-problems in your code. They check different things so you need both. A
+problems in your code. They check different things so you need both. A
potential problem caught by C<use strict;> will cause your code to stop
immediately when it is encountered, while C<use warnings;> will merely
give a warning (like the command-line switch B<-w>) and let your code run.
@@ -163,7 +163,7 @@ A scalar represents a single value:
Scalar values can be strings, integers or floating point numbers, and Perl
will automatically convert between them as required. There is no need
to pre-declare your variable types, but you have to declare them using
-the C<my> keyword the first time you use them. (This is one of the
+the C<my> keyword the first time you use them. (This is one of the
requirements of C<use strict;>.)
Scalar values can be used in various ways:
@@ -267,9 +267,9 @@ More complex data types can be constructed using references, which allow
you to build lists and hashes within lists and hashes.
A reference is a scalar value and can refer to any other Perl data
-type. So by storing a reference as the value of an array or hash
+type. So by storing a reference as the value of an array or hash
element, you can easily create lists and hashes within lists and
-hashes. The following example shows a 2 level hash of hash
+hashes. The following example shows a 2 level hash of hash
structure using anonymous hash references.
my $variables = {
@@ -328,7 +328,7 @@ running the program. Using C<strict> is highly recommended.
Perl has most of the usual conditional and looping constructs. As of Perl
5.10, it even has a case/switch statement (spelled C<given>/C<when>). See
-L<perlsyn/"Switch statements"> for more details.
+L<perlsyn/"Switch Statements"> for more details.
The conditions can be any Perl expression. See the list of operators in
the next section for information on comparison and boolean logic operators,
@@ -407,6 +407,9 @@ the more friendly list scanning C<foreach> loop.
print "The value of $key is $hash{$key}\n";
}
+The C<foreach> keyword is actually a synonym for the C<for>
+keyword. See C<L<perlsyn/"Foreach Loops">>.
+
=back
For more detail on looping constructs (and some that weren't mentioned in
@@ -461,7 +464,7 @@ before 99).
! not
(C<and>, C<or> and C<not> aren't just in the above table as descriptions
-of the operators. They're also supported as operators in their own
+of the operators. They're also supported as operators in their own
right. They're more readable than the C-style operators, but have
different precedence to C<&&> and friends. Check L<perlop> for more
detail.)
@@ -499,8 +502,8 @@ the list:
my $line = <$in>;
my @lines = <$in>;
-Reading in the whole file at one time is called slurping. It can
-be useful but it may be a memory hog. Most text file processing
+Reading in the whole file at one time is called slurping. It can
+be useful but it may be a memory hog. Most text file processing
can be done a line at a time with Perl's looping constructs.
The C<< <> >> operator is most often seen in a C<while> loop:
@@ -660,7 +663,7 @@ For more information on writing subroutines, see L<perlsub>.
OO Perl is relatively simple and is implemented using references which
know what sort of object they are based on Perl's concept of packages.
However, OO Perl is largely beyond the scope of this document.
-Read L<perlboot>, L<perltoot>, L<perltooc> and L<perlobj>.
+Read L<perlootut> and L<perlobj>.
As a beginning Perl programmer, your most common use of OO Perl will be
in using third-party modules, which are documented below.