Learning Perl

Errata for Learning Perl

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 xvi
changed all the "ora.com"s to "oreilly.com"

Anonymous    Oct 01, 1997
Printed
Page xvii
same change as above

Anonymous    Oct 01, 1997
Printed
Page xviii
in the footnote, changed "environmental variable" to

"environment variable"

Anonymous    Oct 01, 1997
Printed
Page xxiii
in the list of IP addresses, changed the one for

ftp.cs.colorado.edu to 128.138.243.20

Anonymous    Oct 01, 1997
Printed
Page xxix
changed all the "ora.com"s to "oreilly.com"

Anonymous    Oct 01, 1997
Printed
Page xxvi
under "Constant Width" "is used examples" changed to

"is used in examples"

Anonymous    Oct 01, 1998
Printed
Page xxix
This text replaced the "We'd Like to Hear from You" section

in the Preface: "We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). Please let us know about any errors you find, as well as your suggestions for future editions, by writing to: O'Reilly & Associates, Inc. 101 Morris Street Sebastopol, CA 95472 1-800-998-9938 (in the U.S. or Canada) 1-707-829-0515 (international/local) 1-707-829-0104 (FAX) You can also send us messages electronically. To be put on the mailing list or request a catalog, send email to: info@oreilly.com To ask technical questions or comment on the book, send email to: bookquestions@oreilly.com We have a web site for the book, where we'll list examples, errata, and any plans for future editions. You can access this page at: http://www.oreilly.com/catalog/9781565922846/ For more information about this book and others, see the O'Reilly web site: http://www.oreilly.com

Anonymous    Mar 01, 2000
Printed
Page 1
paragraph 2, line 4: "that,f" changed to "that,"

Anonymous    Jul 01, 1998
Printed
Page 3
"bookquestions@ora.com" changed to

"bookquestions@oreilly.com"

Anonymous    Jul 01, 1998
Printed
Page 10
2nd code example, line 1: removed "-w"

Anonymous    Oct 01, 1997
Printed
Page 10
para. 3, last line: "}" changed from Roman to constant

width font

Anonymous    Jul 01, 1998
Printed
Page 16
3rd line from the bottom: changed "&good_word" to "the

subroutine good_word"

Anonymous    Oct 01, 1997
Printed
Page 17
this page starts in a different place due to the change to p. 16

Anonymous    Oct 01, 1997
Printed
Page 18
footnote: removed "again"

Anonymous    Oct 01, 1997
Printed
Page 18
line 3 of text: "We" changed to "we"

Anonymous    Oct 01, 1998
Printed
Page 18

Used to read: If you were running with -w, you would have to check that the return value read in was actually defined. The empty string returned by the <WORDLIST> operation isn't merely empty: it's undef again. The defined function is how you test for undef when this matters. When reading lines from a file, you'd do the test this way: while ( defined ($name = <WORDLIST>) ) { Now reads: If you were running with -w, you would have to check that the return value read in was actually defined. The empty string returned by the <WORDSLIST> operation isn't merely empty: it's undef again. The defined function is how you test for undef when this matters. When reading lines from a file, you'd do the test this way: while ( defined ($name = <WORDSLIST>) ) {

Anonymous    Oct 01, 1999
Printed
Page 20
line 2 of text: "init_word" changed to "init_words"

Anonymous    Jul 01, 1998
Printed
Page 20
1st para, 3rd to last line: "$!" changed from Roman

to constant width font

Anonymous    Jul 01, 1998
Printed
Page 21
removed second sentence from 1st para. (which also removed the

footnote)

Anonymous    Oct 01, 1997
Printed
Page 22
code line -4: changed "-M WORDLIST >= 7.0" to "-M WORDLIST < 7.0"

Anonymous    Oct 01, 1997
Printed
Page 23
same change to last line of code on page

Anonymous    Oct 01, 1997
Printed
Page 24
same change again to line 4 of third code block

Anonymous    Oct 01, 1997
Printed
Page 24
in the first code example, added a semicolon to end of the

next-to-last line

Anonymous    Jul 01, 1998
Printed
Page 24
Added parantheses

chomp ($word; Now reads: chomp ($word);

Anonymous    Apr 01, 1999
Printed
Page 24
Top

There was a line of code missing from the top of the page that now reads: while ($name = <WORDSLIST>) {

Anonymous    Jul 01, 2000
Printed
Page 26
that same change to line 4 on page. Also split the last

sentence in the next-to-last para. into two ("...is formed. So at most," instead of "...is formed, so at most,")

Anonymous    Oct 01, 1997
Printed
Page 27
1st line of 2nd code example: added "-w" option

Anonymous    Oct 01, 1997
Printed
Page 28
2nd line in code: changed "&init_words()" to "init_words()"

Anonymous    Oct 01, 1997
Printed
Page 29
in line 8 of the first code example and line 5 of the second,

changed "7" to "7.0"; also, in line -6 of the first example, changed 'open MAIL,"|mail' to 'open (MAIL, "|mail'

Anonymous    Oct 01, 1997
Printed
Page 29
Line 17 used to read: "can't rename $filename.old"

It now reads: "can't rename $filename".

Anonymous    Apr 01, 1999
Printed
Page 30
para. 2: put "secret" from "something.secret" in constant width

font (not italic)

Anonymous    Oct 01, 1997
Printed
Page 30
the final example, the second line of code

dbmopen (%last_good, "lastdb", 0666),; changed to dbmopen (%last_good, "lastdb", 0666);

Anonymous    Jul 01, 1998
Printed
Page 33
In the paragraph under Single-Quoted Strings, changed "single-quoted

string" in the second-to-last sentence to "double-quoted string."

Anonymous    Apr 01, 1999
Printed
Page 33
In the paragraph under Single-Quoted Strings, "single-quoted

string" in the second-to-last sentence was changed to "double-quoted string." But the examples following this sentence still show a backslash within a single-quoted string, and the whole section is about "Single-quoted strings". Changed it back.

Anonymous    Oct 01, 1999
Printed
Page 35
line 3 from the bottom: "definition as" changed to

"definitions"

Anonymous    Oct 01, 1998
Printed
Page 35
next-to-last line, "asone" changed to "as one."

Anonymous    Oct 01, 1998
Printed
Page 36
next-to-last para.: changed "You don't merely have to" to "You

can't just"

Anonymous    Oct 01, 1997
Printed
Page 38,39
The table heading should say: "Table 2-3. Associativity

and Precedence of Operators: Highest to Lowest"

Anonymous    Jul 01, 1998
Printed
Page 39
Table 2-3: second "Nonassociative" entry: added close

parenthesis "(noninclusive and inclusive range"

Anonymous    Jul 01, 1998
Printed
Page 39
Added three lines to table 2-3

Left << >> Nonassociative < > <= >= lt gt le ge Nonassociative == != <=> eq ne cmp

Anonymous    Apr 01, 1999
Printed
Page 39

Added footnote missing from 5/99 reprint. It now reads: Hex and octal values are not supported in this automatic conversion. Use hex and oct to interpret hex and octal values.

Anonymous    Oct 01, 1999
Printed
Page 43
Changed in last footnote to

Or whatever the input record separator $/ is set to.

Anonymous    Apr 01, 1999
Printed
Page 45
The term "variable interpolation," in the first sentence of the

second paragraph, is now in italics

Anonymous    Oct 01, 1998
Printed
Page 46
1st para., line 3: "standard" started with an italic "s" changed

it to normal roman type

Anonymous    Oct 01, 1998
Printed
Page 47
added "times the radius" to the end of answer #1

Anonymous    Oct 01, 1997
Printed
Page 48
line 1 of code 2: changed "($a, 17;" to "($a,17);"

Anonymous    Oct 01, 1997
Printed
Page 49
Changed last line of code to

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

Anonymous    Apr 01, 1999
Printed
Page 49
Changed $a to @a in the last paragraph.

Anonymous    Apr 01, 1999
Printed
Page 49.4.2

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    Oct 01, 1999
Printed
Page 49.6.1

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    Oct 01, 1999
Printed
Page 51
first code example, line 3: changed

($a,$b,$c) to ($a,$b,$c);

Anonymous    Jul 01, 1998
Printed
Page 52
next-to-last code example: added semicolons to the

end of each line

Anonymous    Jul 01, 1998
Printed
Page 52
in first sample code

@fred = @barney = (2, 3, 4); ' # same thing deleted that extraneous apostrophe. line now reads @fred = @barney = (2, 3, 4); # same thing

Anonymous    Jul 01, 1998
Printed
Page 53
para. 4: changed "that is, an index of less than zero or greater

than" to "that is, an index of greater than" and deleted the para. beginning "Assignment to an array element..."

Anonymous    Oct 01, 1997
Printed
Page 53
para. 4, line 1: "beyond the ends" changed to

"beyond the end"

Anonymous    Jul 01, 1998
Printed
Page 55
line 2 of code 2: changed "happy day" to "happy days"

Anonymous    Oct 01, 1997
Printed
Page 64
next-to-last para., line 2: "$_" changed from Roman to

constant width font

Anonymous    Jul 01, 1998
Printed
Page 64
next-to-last para., line 2: $_ is set in Roman, is now in

constant width

Anonymous    Oct 01, 1998
Printed
Page 69
The values Function, paragraph 1, lines 1-3: %arrayname has been changed

to %hashname in 3 places.

Anonymous    Apr 01, 1999
Printed
Page 70

In the 5th paragraph in "Hash Slices" section, line of code used to read: @league{keys %score} = values %score; It now reads: %league{keys %score} = values %score;

Anonymous    Apr 01, 1999
Printed
Page 72
3rd code block, line 1: changed "($line_" to "($line)"

This was a mistake on my part - $line_ should have been changed to $line (i.e. I incorrectly added a close paren).

Anonymous    Oct 01, 1997
Printed
Page 72
"while" example, line 1: removed the close parenthesis

after "$line"

Anonymous    Jul 01, 1998
Printed
Page 72
last para., line 1: "$_" changed to constant width font

Anonymous    Jul 01, 1998
Printed
Page 73
1st line: changed 'STDIN>_)"' to '<STDIN>)) {"'

Anonymous    Oct 01, 1997
Printed
Page 79
line 2 from the bottom: The "a" in "a b" changed to Roman.

So did the period after the "c".

Anonymous    Jul 01, 1998
Printed
Page 80

To get five or less x's, you must put the zero in, as in /x{0,5}/. should read: To get five or fewer x's, you must put the zero in, as in /x{0,5}/.

Anonymous   
Printed
Page 82
last paragraph, line break changed: "songbird" appears as one

word, without a hyphen

Anonymous    Dec 01, 1998
Printed
Page 83
1st line of code: lower-cased "Frederick"

Anonymous    Oct 01, 1997
Printed
Page 84
next-to-last para.: changed "$4" to "4" and "$1" to "1"

Anonymous    Oct 01, 1997
Printed
Page 85
Under "Selecting a Different Target (the =~ Operator)"

the "1" (number one) in the third and fourth lines changed to an "l" (letter el) **This change was made in the 7/98 reprint; however, it is incorrect. The code should read "1" (number one), not "l" (letter el). So here's how it should read (letter L capitalized only to emphasize it): $a =~ /(.)1/; # also true (matches the double L)

Anonymous    Jul 01, 1998
Printed
Page 85

The code was incorrectly changed in the 7/98 reprint to read : "l" (letter el) instead of "1" (number one). It has been changed to (letter L capitalized only to emphasize it): $a =~ /(.)1/; # also true (matches the double L)

Anonymous    Oct 01, 1999
Printed
Page 87
middle para.: "That's sounds" changed to "That sounds"

Anonymous    Oct 01, 1998
Printed
Page 88
next-to-last code example, line 1: added semicolon to end

of the line, after "hello, world"

Anonymous    Jul 01, 1998
Printed
Page 90

The second example from the bottom used to read: $result = (join "+", "", @fields); Moved parantheses, so it now reads: $result = join ("+", "", @fields);

Anonymous    Apr 01, 1999
Printed
Page 93
last code example, line 2: added a semicolon after

say_hello()

Anonymous    Jul 01, 1998
Printed
Page 94
In subroutine "gimme_a_or_b" (last code example, lines 4 and 7)

wrong keyword: changed "returns", is "return".

Anonymous    May 01, 1999
Printed
Page 97

2nd code sample: line 10 used to read: @result; # return the final list It now reads: return@result; # return the final list

Anonymous    Apr 01, 1999
Printed
Page 115
line 2: changed "stat1(2)" to "stat(2)"; in first line of code,

changed the last } to ]

Anonymous    Oct 01, 1997
Printed
Page 121
Format, line 2: "cool" has been replaced by "pretty" in 3 places.

Anonymous    Apr 01, 1999
Printed
Page 130
In the first snippet of code: "/dev/hosts" has been changed to

"/etc/hosts"

Anonymous    Apr 01, 1999
Printed
Page 134
next-to-last line of para. 1: "support rich" should be

"support-rich"

Anonymous    Jul 01, 1998
Printed
Page 136
In the 1st paragraph: "File::Find" has been changed to "File::Copy"

Anonymous    Apr 01, 1999
Printed
Page 139
In the foreach loop example

warn "hmm... couldn't chmod $file.$!"; Now reads: warn "hmm... couldn't chmod $file: $!";

Anonymous    Apr 01, 1999
Printed
Page 140
last code example, line 2: added a semicolon to the end

of the line

Anonymous    Jul 01, 1998
Printed
Page 147
line -5: changed "pid" to "child_pid"

Anonymous    Oct 01, 1997
Printed
Page 147
last code, 1st line: fork()) changed to fork()))

Anonymous    Jul 01, 1998
Printed
Page 148
line 4 of last code example: changed "$pid" to "$kidpid"

Anonymous    Oct 01, 1997
Printed
Page 148
last code, 1st line: fork()) changed to fork()))

Anonymous    Jul 01, 1998
Printed
Page 157
2nd para.: replaced "sort subroutine" with "comparison

routine"; and in the 3rd para. from the bottom, replaced "sort routine" with "comparison routine" (2 occurrences)

Anonymous    Oct 01, 1997
Printed
Page 164
In the third paragraph, changed last sentence before code. The text used

to read: ...into an array with the following values: It now reads: ...into a list with the following values:

Anonymous    Apr 01, 1999
Printed
Page 177
next-to-last line of para. 1: changed "represented as $" to

"represented as $."

Anonymous    Oct 01, 1997
Printed
Page 187
Changed import tag ":html3": removed "proposed."

Anonymous    Apr 01, 1999
Printed
Page 187

In the program at bottom of page, line 5: h1("Hello World") now reads: h1("Greetings, Terrans!").

Anonymous    Apr 01, 1999
Printed
Page 189
first code, lines 8 and 11: "print p(..." changed to

"print q(..."

Anonymous    Jul 01, 1998
Printed
Page 189

In the code at the top of the page, lines 8 and 11 used to read: "print q(......," They now read: "print p(......"

Anonymous    May 01, 1999
Printed
Page 192
next-to-last para., line 2: changed "anonymous hashes" to

"anonymous arrays"

Anonymous    Oct 01, 1997
Printed
Page 198
Code section my(, 6th line

"$entry," now reads "$entry" (deleted comma)

Anonymous    Dec 01, 1999
Printed
Page 199
3rd-from-last para.: changed "Z" to "2"

Anonymous    Oct 01, 1997
Printed
Page 199
line -8: "LOCK-EX" should be "LOCK_EX"

Anonymous    Jul 01, 1998
Printed
Page 200
paragraph 1, line 2: "the the" chnaged to "the"

Anonymous    Oct 01, 1998
Printed
Page 201
2nd code block, lines 3 and 4: "$CHATFILE" now reads "$CHATNAME"

Anonymous    Apr 01, 1999
Printed
Page 207

2nd code example, line 9 use to read: "$result->title" Now reads: "$webdoc->title"

Anonymous    Apr 01, 1999
Printed
Page 215
#5, para. 4, line 2: "less than 32" should be "less

than or equal to 32"

Anonymous    Jul 01, 1998
Printed
Page 215

2nd para. used to read: "because that element has been printed" Now reads: "because that element has been popped"

Anonymous    Apr 01, 1999
Printed
Page 217
the answer to #2 was missing. I added this line after #1

2. See the Addendum on page 271, after the index, for the answer to this exercise. This made the answers that were numbered 2 and 3 into 3 and 4.

Anonymous    Jul 01, 1997
Printed
Page 219
Solution to chapter 7 question 2c changed to

while (<>) { print if (/^[^aeiou]*a[^eiou]*e[^aiou]*i[^aeou]*o[^aeiu]*u[^aeio]*$/); }

Anonymous    Jul 01, 1998
Printed
Page 223
added this line after the answer to #1 from chapter 9

2. See the Addendum on page 271, after the index, for the answer to this exercise.

Anonymous    Jul 01, 1997
Printed
Page 225
1st paragraph, line before the last: "write" changed to constant width

font

Anonymous    Jul 01, 1998
Printed
Page 231
In the answer for Question 3,

"for (sort by_last keys %last) {" Now reads "foreach (sort by_last keys %last) {"

Anonymous    Oct 01, 1999
Printed
Page 232
#1, sub by_last: $last{a} now reads $last{$a}.

Anonymous    Apr 01, 1999
Printed
Page 233
In the first paragraph, line 3, changed "chomps" to "chops"

Anonymous    Apr 01, 1999
Printed
Page 234
Chapter 18, #1, line 9 of code: the extra close parenthesis

was deleted

Anonymous    Jul 01, 1998
Printed
Page 238

Paragraph 1, line 2 now reads: Deleted Modules new to 5.004 are marked like this.

Anonymous    Apr 01, 1999
Printed
Page 246
under "Proto": line 3: "this of this type" changed to "of this

type"

Anonymous    Oct 01, 1998
Printed
Page 252

Other Operators, paragraph 1, line 2 used to read: "? :" It now reads: "? :".

Anonymous    Apr 01, 1999
Printed
Page 252
Many, Many More Functions, grep and map, map examples, line 3,

comment: "unchop" now reads "unchomp"

Anonymous    Apr 01, 1999
Printed
Page 257
added to "=" entry

=> operator, 193-194

Anonymous    Oct 01, 1997
Printed
Page 257
Index

2nd column, 7th line, the following has been deleted: $- variable, 127 (This was a duplicate to 1st column, 16th line)

Anonymous    Dec 01, 1999
Printed
Page 258

"associative arrays" index entry now reads: associative arrays (hashes), 10, 66

Anonymous    Dec 01, 1998
Printed
Page 262
added index entry

hashes (see associative arrays)

Anonymous    Dec 01, 1998
Printed
Page 271
This whole page is new.

Addendum: Additional Answers for Appendix A Exercises Here is the answer to exercise 2 from Chapter 6: 2. Here's one way to do it: @ARGV = reverse @ARGV; print reverse <>; The first line just takes any filename arguments and reverses them. That way if the user called this script with command line arguments "camel llama alpaca", @ARGV would then contain "alpaca llama camel" instead. The second line reads in all the lines in all the files in @ARGV, flips them end on end, and prints them. If no arguments were passed to the program, then as before, <> works on STDIN instead. Here is the answer to exercise 2 from Chapter 9: 2. Here's one way to do it: { print "Enter a number (999 to quit): "; chomp($n = <STDIN>); last if $n == 999; $sum += $n; redo; } print "the sum is $sum "; We're using a naked block with a redo and a last to get things done this time. Start by printing the prompt and grabbing the number. If it's 999, exit the block with last and print out the sum on exit. Otherwise, we add to our running total and use redo to execute the block again.

Anonymous    Jul 01, 1997
Printed
Page 273-274
the colophon was omitted last time due to a printer error -

I sent them these pages for re-inclusion.

Anonymous    Oct 01, 1997