Errata

Learning Perl on Win32 Systems

Errata for Learning Perl on Win32 Systems

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page xviii
changed "103 Morris Street, Suite A" to "101 Morris Street"

Anonymous    Sep 01, 1997
Printed
Page 24
In the code for sub init_words, line 3 changed to

while (defined ($name = <WORDSLIST>)) {

(missing close paren)

Anonymous    Apr 01, 1998
Printed
Page 26

Code used to read:

die "can't open wordlist:$!"

It now reads:

die "can't open wordslist:$!"
^

Anonymous    Apr 01, 1999
Printed
Page 28
The first footnote starts


"Perl for Win32 programmers will encounter this mail
comand issue frequently...."

"comand" should be "command."

Anonymous   
Printed
Page 29
The init_words() definition: line 6: same change as on p. 24

Anonymous    Apr 01, 1998
Printed
Page 29
footnote 3, code line 2: changed "/.sec/," to "/.sec$/,"

Anonymous    Aug 01, 1998
Printed
Page 32
code line 6: changed "($name = <WORDSLIST>) {" to

"($name = <WORDSLIST>)) {" (added right parenthesis)

Anonymous    Aug 01, 1998
Printed
Page 32
code lines 11-18: replaced these lines

}
} else { # rename the file so it gets noticed
rename ($filename, ""$filename.old");
}
close (WORDSLIST) ||
die "couldn't close $filename: $!";
}
}

with these lines

}
close (WORDSLIST) ||
die "can't close $filename: $!";
}
else {
# must close file before renaming it
close (WORDSLIST) ||
die "can't close $filename.old: $!"
rename ($filename,"$filename.old") ||
die "can't rename $filename: $!";
}
}
}

Anonymous    Aug 01, 1998
Printed
Page 32
code

# must close file before renaming it
close (WORDLIST) ||
die "can't close $filename.old: $!"
rename ($filename,"filename.old") ||
die "can't close $filename: $!";

Line 3 now reads $filename, not $filename.old. Also, a semicolon was added at
the end.

Anonymous    Jan 01, 2001
Printed
Page 35
3rd line from bottom: same change again

Anonymous    Apr 01, 1998
Printed
Page 36
code lines 3-10: same fix as page 32

Anonymous    Aug 01, 1998
Printed
Page 36
code

close (WORDSLIST) ||
die "can't close $filename.old: $!"

"$filename.old" now reads "$filename." Also, a semicolon was added at the end.

Anonymous    Jan 01, 2001
Printed
Page 41
The list of double-quoted string escapes is incomplete. The

backslash-dollar sign ($) sequence prevents substition of variable names by
their values.

Anonymous   
Printed
Page 42
Line 2 of last code block: changed "5.1 - 2." to "5.1 - 2.4"

Anonymous    Apr 01, 1998
Printed
Page 46
Table 2-3: above row 4, "Nonassociative | Named unary ...",

added 1 row:

Left << >> (shift operators)

("<< >>" is in constant-width font)

under row 4, "Nonassociative | Named unary ...", added 2 rows:

Nonassociative < > <= >= lt gt le ge (relational operators)
Nonassociative == != <=> eq ne cmp (equality operators)

("< > <= >= lt gt le ge" and "== != <=> eq ne cmp" are in
constant-width font)

Anonymous    Aug 01, 1998
Printed
Page 55
1st code, line 1

"array" now reads "list" (it's not yet an array).

Anonymous    Jan 01, 2001
Printed
Page 56
The double-dot expander in all examples should yield integers, not

decimals.

Anonymous   
Printed
Page 56

Code sample 6: changed "$a" to "@a" so that the line reads:

print("The answer is ", @a,"
");

and in the following line,

"the value of $a" should be "the value of @a"

Anonymous    Apr 01, 1999
Printed
Page 56

Used to read:

(1.2 .. 5.2) # same as (1.2, 2.2, 3.2, 4.2, 5.2)

Now reads:

(1.2 .. 5.2) # same as (1, 2, 3, 4, 5)

Anonymous    Jul 01, 1999
Printed
Page 56

Used to read:

(1.3 .. 6.1) #same as (1.3,2.3,3.3,4.3,5.3)

Now reads:

(1.3 .. 6.1) #same as (1, 2, 3, 4, 5, 6)

Anonymous    Jul 01, 1999
Printed
Page 56
3rd code fragment

(1.3..6.1) # same as (1, 2, 3, 4, 5)

now reads

(1.3..6.1) # same as (1, 2, 3, 4, 5, 6)

Anonymous    Jan 01, 2001
Printed
Page 75
code sample 4, lines 1 and 4: changed "%somearray" to

"%somehash" (still in constant-width italics) and
line 2: changed "hash" to "array"

Anonymous    Aug 01, 1998
Printed
Page 77
next-to-last code line under "Hash Slices"

%league{keys %score} = values %score;

changed to:

@league{keys %score} = values %score;

Anonymous    Apr 01, 1998
Printed
Page 77
code sample 6: changed "%score)" to "%score}"

Anonymous    Aug 01, 1998
Printed
Page 82

Did read:

2. Modify the program from the previous exercise so that each file
specified on the command line has its lines individually reversed.
(Yes, you can do this with only what's been shown to you so far,
even excluding the stroll in Chapter 1).

Now reads (clarified):

2. Modify the program from the previous exercise so that each file
specified on the command line has its lines individually reversed.
That is, the output consists of the last line of the first file
through the first line of the first file, followed by the last
line of the second file through the first line of the second file,
until all the files are complete.

Anonymous    Mar 01, 2000
Printed
Page 87
sequence

"Perl matches 'abc' as an 'a' followed by 'a b' followed by 'a c'"
now reads:
Perl matches 'abc' as an 'a' followed by a 'b' followed by a 'c'

where single quoted text is the monospace font and unquoted text is
the standard serif font.

Anonymous    Mar 01, 2000
Printed
Page 93
In line 3 of the first code example, changed the 1 (one) to an l (el)

**This change was made in the 4/98 reprint; however, it is incorrect.
The code should read 1 (one), not l (el). So here's how it should
read (letter L capitalized only to emphasize it):

$a =~ /(.)1/; # also true (matches the double L)

Anonymous    Apr 01, 1998
Printed
Page 93

The code was incorrectly changed in the 4/98 reprint to read:

"l" (letter el) instead of "1" (number one): changed it back.
Here's how it now reads (letter L capitalized only to
emphasize it):

$a =~ /(.)1/; # also true (matches the double L)

Anonymous    Jul 01, 1999
Printed
Page 95
para. before "Special Read-Only Variables": changed "contstruct" to

"construct"

Anonymous    Apr 01, 1998
Printed
Page 98
line 2 of 2nd code: changed "$fouth" to "$fourth"

Anonymous    Apr 01, 1998
Printed
Page 98
3rd block of text: changed "would simply gives" to "would simply

give"

Anonymous    Apr 01, 1998
Printed
Page 98
code sample 5: changed

$result = (join "+", "", @fields;)
to
$result = join("+", "", @fields);

Anonymous    Aug 01, 1998
Printed
Page 98
code sample 6: changed

$output = join ("
", @data, "";)
to
$output = join ("
", @data, "");

(transposed the right parenthesis and the semi-colon)

Anonymous    Aug 01, 1998
Printed
Page 121

The last three lines of the second code example used to read:

close(IN); || die "can't close $a:$!"
close(OUT); || die "can't close $b:$!"
}

They now read:

}
close(IN) || die "can't close $a: $!";
close(OUT) || die "can't close $b: $!";

Anonymous    Apr 01, 1998
Printed
Page 146
The second line of code changed to

rmdir("gravelpit") || die "cannot rmdir gravelpit: $!";

Anonymous    Apr 01, 1998
Printed
Page 147
code sample 1, line 3: removed the backslash ()

Anonymous    Aug 01, 1998
Printed
Page 147
para. 3, line 3: changed "GetFileAttributes" to

"GetAttributes" and "SetFileAttributes" to "SetAttributes"

Anonymous    Aug 01, 1998
Printed
Page 164
removed last sentence of second-to-last paragraph

"This processing is similar in operation to..."

Anonymous    Dec 01, 1998
Printed
Page 167
In the last code example, "$user" in line 2 now reads "$username"

Anonymous    Mar 01, 2000
Printed
Page 188
The 'HOWDY' program

added an extra blank line at the end of the code
(after line "END_of_Multiline_Text)

added this sentence to the 2nd paragraph from the bottom, following the
second to last sentence (ending in "at the start of the line"):

"The end token must not have any surrounding whitespace and
the line it's on must be terminated with a newline."

Anonymous    Mar 01, 2000
Printed
Page 196
para. 2, line 3: changed "['," to "['mint',"

(still in constant-width font)

Anonymous    Aug 01, 1998
Printed
Page 196

code sample 2 now reads:

print p("What flavor: ", popup_menu("flavor",
['mint','cherry','mocha']))

Anonymous    Aug 01, 1998
Printed
Page 202
In section my() in code "$LOCK_EX," now reads "$LOCK_EX"

(deleted comma)

Anonymous    Mar 01, 2000
Printed
Page 205
code 1, lines 3 and 4: changed "$CHATFILE" to "$CHATNAME"

Anonymous    Aug 01, 1998
Printed
Page 214

Used to read:

www.microsoft.com/msdn/sdk

Now reads:

http://msdn.microsoft.com/developer/sdk/

Microsoft has renamed the 'Active Messaging Library' the 'Collaboration Data
Objects (CDO) Library', which can be found at
http://msdn.microsoft.com/library/ --> Platform SDK --> Messaging and
Collaboration Services

Anonymous    Jul 01, 1999
Printed
Page 222
removed last 2 sentences of third paragraph, starting with

"This last message is a complete statement..."

Anonymous    Dec 01, 1998
Printed
Page 228
2a. end of last para. added this sentence: "For more

information on using the && operator as a control structure,
please refer to the section, "&&, ||, and ?: as Control
Structures," in Chater 9." ("&&" is in constant-width font.)

Anonymous    Aug 01, 1998
Printed
Page 229
line -2: added close paren after "-4"

Anonymous    Apr 01, 1998
Printed
Page 229
Question 2

c. A third way to do this is:
if (/^[eiou]*....
now reads:
if (/[^eiou]*....

Anonymous    Mar 01, 2000
Printed
Page 236
Chapter 14, Exercise 1 solution

The source code yields a script that doesn't execute properly on my system
(WinNT 4.0 SP5). It appears that escaping occurs in a scalar enclosed in ``.

Here's the an example of me running the script and the output:

C:Learning_PERLLP-W32>perl 14-1.plx Learning_PERLLP-W32foo
Learning_PERLLP-W32ar

File not found - Learning_PERLLP-W32foo

One solution to this problem is:

my ($src, $trg) = @ARGV;
die "$src is not a directory" unless -d $src;
die "$trg is not a directory" unless -d $trg;

$from =~ s/\/\\/g; # <------- Insert these substitution lines
$to =~ s/\/\\/g; # <------/

`xcopy /s /e $src $trg`;

INDEX:

Anonymous   
Printed
Page 269
above index entry "-= operator", added index entry

"=> operator, 197-198"

Anonymous    Aug 01, 1998
Printed
Page 270
left column: changed "AddConnectio" to "AddConnection"

Anonymous    Apr 01, 1998
Printed
Page 270
removed these index entries and their subentries

"associative array keys", "associative array operators", and
"associative arrays"

Anonymous    Aug 01, 1998
Printed
Page 271
should include "bail", 199

Anonymous   
Printed
Page 271
last item in right-hand column: changed "Control-D" to "Control-z"

Anonymous    Sep 01, 1997
Printed
Page 271
replaced this entry

chop( ) operator
defined, 50, 62
examples of, 25, 35, 52, 120, 221
introduced, 13

with these entries

chomp( ) operator
defined, 62
examples of, 25, 35, 52, 120, 221
introduced, 13
chop( ) operator, defined, 50

Anonymous    Aug 01, 1998
Printed
Page 272
index entry "double-quoted strings, and associative array

elements": changed "associative array" to "hash"

and index entry "empty list, and clearing out an associative
array": changed "an associative array" to "a hash"

Anonymous    Aug 01, 1998
Printed
Page 273
should include "flock", 199

Anonymous   
Printed
Page 274
added these index entries

hash keys, 16
hash operators, 75
hashes
creating new elements of, 74
defined, 73
example of assignment to, 17
introduced, 16
literal representation of, 74
order in, 73
removing elements from with delete, 76
sorting (sort-of), 163
stepping through with each( ), 76
variables, 73

Anonymous    Aug 01, 1998
Printed
Page 275
Remove the "local()" entry.

Anonymous   
Printed
Page 275
index entry "keys, of associative arrays" changed to

"keys, of hashes"

removed index entry "lpr command, example of, 153"

Anonymous    Aug 01, 1998
Printed
Page 276
Add "my()", 105, 131, 229.

Anonymous   
Printed
Page 277
added index entry: "qw( ), 15, 190"

Anonymous    Aug 01, 1998
Printed
Page 280
added index entry: "use statement, 190"

Anonymous    Aug 01, 1998
Printed
Page 284
added the following to end of next-to-last para.

Whenever possible, our books use RepKover (tm), a durable and
flexible lay-flat binding. If the page count exceeds RepKover's limit,
perfect binding is used.

Anonymous    Sep 01, 1997