Errata

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
Printed Page 11
5th paragraph

In the first line, the text "comp.lang.perl.*" appears. The "*" appears
raised (and in italic), which makes it look like a footnote. Only now did
I just realize that it was meant as a wildcard rather than a footnote. The
"*" should be lowered or omitted.

Anonymous   
Printed Page 11
5th paragraph

The unconfirmed errata is wrong. The asterisk in "comp.lang.perl.*" is shown, as
stated in the text, to denote a hierarchy of Usenet groups, e.g.
comp.lang.perl.announce, comp.lang.perl.moderated, etc. The asterisk is not the
smaller, superscripted, regular typefaced as other footnoted denotations. But rather,
it is a full-sized and italicized as the rest of the Usenet group name
"comp.lang.perl". There is no error.

Anonymous   
Printed Page 15
on page 15

On page 15, I encountered the following:

"(By the way, you should be careful to spell it usr and not user - the folks who invented Unix were lazy typists, so they omitted a lot of letters.)"

"usr" stands for "Unix System Resource."

Anonymous  Jun 22, 2010 
Printed Page 21
Second to last paragraph

The word "three" in the first line is redundant. "....they're all three the same
number" should read: "....ther're all the same number"

Anonymous   
Printed Page 21
2nd to last paragraph, 2nd sentence.

In the middle of the sentence: ... you write 0xFF or 255.[Line Wrap]000, so choose
the ... The line break is misleading. The senetence appears to end, then the next
sentence appears to begin with 000.

Anonymous   
Printed Page 30
16th line

Line reads:
$barney = "fred ate a $meat";

Should read:
$barney = "fred ate a $meal";

Anonymous   
Printed Page 30
16th line

This unconfirmed errata item is wrong, the text is correct as it was trying
to introduce what appears to be a misspelling to cause an undefined variable.

Anonymous   
Printed Page 37
Second to last paragraph

"make an numeric" should be "make a numeric"

Anonymous   
Printed Page 37
Code segment starting # Add up some odd numbers

$sum is not undef'ed before use. Seeing as this is an example of undef, there should
be a reference to an undef.

Anonymous   
Printed Page 38
The defined function: 1st code example

$madonna = <STDIN>;
if ( defined ($madonna) ) {
print "The input was: <<$madonna>>
"; # set off input with angles
} else {
print "No input available!
";
}

But in this example $madonna will always capture at least a newline.
Hence, $madonna can never be undefined and will never get the "No
input available" result.

Anonymous   
Printed Page 38
The defined function: 1st code example

This unconfirmed errata item is wrong. As the introductory text and footnote
indicate, the line-input operator will return undef when end-of-file is detected
(even possibly from the keyboard). This is what the example is trying to show.

Anonymous   
Printed Page 43
First code line (in the comment section)

"#easier to do that" should be "#easier to do than"

Anonymous   
Printed Page 69
Code Sample

the sub which_element_is is written to return -1 for non-matches, which,
if used when subscripting an array will return the last element of the
array, probably not what the caller intended. So not only would returning
undef be more "Perlish" it would be less dangerous.

Anonymous   
Printed Page 77
7th paragraph

The example given is

$family_name{"betty"} .= $family_name{"barney"};

to explain how if the hash element does not exist, it is created. But I find
the example a bit confusing if I assume that the element DOES exist. e.g. If
$family_name{"betty"} contains 'Smith ', then am I right in thinking that the
example given would make it become 'Smith rubble' - then if it was applied
again it would become 'Smith rubblerubble'? If that's the case, then fine -
I've understood what is happening, and just sanity testing the example too much.
I feel the example is concentrating on what happens if the element does not
exist, but if it does exist, I can't see what useful purpose the example serves.
It would help me understand better if the accompanying text explained what
happened if the hash element does exist and contains a value.

Anonymous   
Printed Page 79
3rd paragraph

The (excellent) book, on page 79, talks about what happens when you reverse
a hash. Cool. Since I understand what a hash table "really" is, I understand
that keys are unique, values are not guaranteed to be unique. You explain
this concept well.

However, you use the example of the IP address/ hostname hash as one that can be
reversed because it only contains unique values. This is not true, if you think
about it for a second. The example is:

%ip_address = reverse %host_name;

In fact, many hostnames may point to one IP address. Happens a lot, especially
with the craze of virtual hosting. I don't know of an example that actually
works for this concept, but this one does not.

Anonymous   
Printed Page 103
second paragraph

3rd Edition:

Last sentence reads "If you pattern matches...", but should read "If your pattern
matches...".

Anonymous   
Printed Page 103
2nd paragraph

Does read:

... the output will say "|before<match>after|", ...

Should read:

... the output will say "Matched: |before<match>after|", ...

RJOllos  Mar 11, 2010 
Printed Page 111
3rd para

flintsone should read flintstone

Anonymous   
Printed Page 138
2nd block of code

In the program code an 'elsif' is used where an 'else' would suffice.

Anonymous   
Printed Page 150
Last paragraph, last line

Sentence reads "Just as when the greater-then sign is used in shell"

Change "greater-then" to "greater-than"

Anonymous   
Printed Page 182
last paragraph

It's printed:
But unless you can quickly can figure that ...

where I supose would be printed
But unless you can quickly figure that...

Anonymous   
Printed Page 183
The book states

To remove empty directories, use the rmdir function in a manner
similar to the unlink function:

rmdir glob "fred/*"; # remove all empty directories below fred/

...

As with unlink, rmdir returns the number of directories removed, and if
invoked with a single name, sets $! in a reasonable manner on a failure.

According to the latest PERL to which I have access (5.6.0), this example
does not work. "rmdir" can only remove one directory.

Furthermore, the third edition of _Programming Perl_ states (on p. 777) the
following:

rmdir FILENAME

This function deletes the directory specified by FILENAME if the
directory is empty. If the function succeeds, it returns true;
otherwise, it returns false.

So I believe that both the sample code AND the description of what "rmdir"
returns is erroneous on p. 183 of _Learning Perl_.

Anonymous   
Printed Page 185
The line...

you set it) with the utime function. That's because it's primary purpose is

should have

its primary purpose

instead of

it's primary purpose

"it's" is a contraction standing for "it is." "its" is the possessive
pronoun needed in this sentence.

Anonymous   
Printed Page 192
Last paragraph, 2nd sentence

"This mean" should be "This means"

Anonymous   
Printed Page 204
2nd paragraph

"from 1 to 16, 1 to 32, or 1 to 63" should PROBABLY be "1 to 16, 1 to 32, or 1 to 64"

Anonymous   
Printed Page 217
second to last paragraph.

The formatting of the text '"}' at the end of $score{"barney"} is in the
wrong font (it's in the font of the text rather than that of the code
snippet.)

Anonymous   
Printed Page 219
1st code fragment

$family_name{$a} cmp $family_name{$a} or
should probably be
$family_name{$a} cmp $family_name{$b} or
^

Anonymous   
Printed Page 219
1st code example

$personal_name{$a} cmp $family_name{$b}
should probably read
$personal_name{$a} cmp $personal_name{$b}
^^^^^^^^
because you've alread sorted by family name in the previous line

Anonymous   
Printed Page 219
Code after 2nd Paragraph

The following two lines should be changed from:

$family_name{$a} cmp $family_name{$a} or
$personal_name{$a} cmp $family_name{$b} or

to:


$family_name{$a} cmp $family_name{$b} or
$personal_name{$a} cmp $personal_name{$b} or

Jesse Chia  Oct 21, 2009 
Printed Page 221
second paragraph

Every system thas has Perl ...

should be:

Every system that has Perl ...

Anonymous   
Printed Page 225
third paragraph (and page 227, fourth paragraph, etc.)

The text reads:

..., giving a format string of "a40 C I5 L". Each record is
thus 55 bytes long. ...

On my system, and I assume most systems that readers of the book have access
to, this format comes out to 65 bytes long as 'I' is a four byte integer,
not a two byte integer as described in the text. I understand that Perl
sometimes relies on underlying 'C' types and that 'C' ints can be two bytes
on some systems. (Unfortunately, I can't find any Perl documentation that
states how these pack formats relate to the underlying architecture.) But
this should either be made clear in the text or an example that is likely to
work on the majority of reader's machines should be used. (e.g. use 'S'
format since we're trying to contain values up to 300.)

Anonymous   
Printed Page 246
first footnote

The second sentence states "If it sounds as if we're not repeating..."
should probably state "If it sounds as if we're repeating...".

Anonymous   
Printed Page 249
1st paragraph

exercises was misspelled as excerses

Anonymous   
Printed Page 255
End of 7th paragraph

At the end of the 2nd last paragraph on page 255 there's an asterix to indicate a
footnote ("since Perl has to look up $word in the hash just once.*"). The footnote
for this does not appear until the next page (p256).

Anonymous   
Printed Page 263
Last paragraph

This pattern is surprisingly tricky to get right.
The pattern shown, /(w+)(s+1)+/, matches
|I though<t t>hat that that was the problem|.
It is supposed to match
|I thought <that that that> was the problem|.
The pattern requires a leading word anchor, thusly: /(w+)(s+1)+/.

Anonymous   
Printed Page 264
last line

The second exercice asks for an identifier name (made of letters, digits, and u
nderscores...), so we can suppose that the name as at least 2 characters.

The proposed answer for those names is [a-z_]w*, but that match names with on
ly one character. I understand that a better solution would be [a-z_]w+

Index: missing "$$" entry, it's covered on 183.

Anonymous   
Printed Page 284
Last paragraph

"It's primary uses are" should be "Its primary uses are"

Anonymous   
Printed Page 313
Index; heading "S"

Missing Entry for "Scooby Doo, Pronouncing 'Windex'" should point to p 209

Anonymous