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.
| Version |
Location |
Description |
Submitted by |
Date submitted |
| PDF |
Page page 120, section "Collection of file handles"
Two code samples and two paragraphs between them |
The first code sample:
"When the while is done, the $fhs goes out of scope, closing
our filehandles for us." — Explanation is misleading and incorrect. The fact that $fhs goes out of scope does not matter since it is a state variable. The file handles will be closed at "global destruction" phase when Perl interpreter exits. Of course this happens when the while is done, but average reader assumes "when the while is done" means "right after the while is done", not "sometime in the distant future".
The next code sample shows how to emulate state variable in pre-5.10 Perl. The sample is incorrect. The trick works for closures:
sub foo {state $var; ... };
and
{ my $var; sub foo { ... }; }
are equivalent because even if we leave the block, the lexical variable $var is not directly accessible any more, but still exists because foo is a package-level name: foo still refers to the subroutine/closure, which refers to the lexical variable $var.
Remove a subroutine, and magic disappears:
{state $var; ... }
and
{ my $var; { ... }; }
are not equivalent in general case: state $var still exists after leaving the scope, but my $var does not. There must be a chain of references from something existing to the lexical $var.
In the second code sample in the book there is no subroutine. The second code sample behaves as described above ("When the while is done, the $fhs goes out of scope, closing
our filehandles for us."), but the second code sample is not equivalent to the first code sample.
|
vdb |
Aug 12, 2026 |
| PDF |
Page page 138, section "Using Common Patterns"
the first code sample at the top |
while( <> ) {
print if /$RE{URL}{HTTP}/;
}
It is a mistake, must be $RE{URI}{HTTP}, not $RE{URL}{HTTP}.
|
vdb |
Aug 13, 2026 |
| PDF |
Page page 137, section "Using Common Patterns"
the last paragraph |
"Instead of creating our own pattern, we can use the one that Regexp::Common provides. It exports a hash reference named $RE…" — Regexp::Common does NOT export a hash reference named $RE. Regexp::Common exports hash %RE. Dollar appears in front of RE when we accessing a hash element by indexing RE: $RE{URI}.
(Ok, strictly speaking, Regexp::Common exports _tied_ hash %RE.)
|
vdb |
Aug 13, 2026 |
| PDF |
Page page 139, section "Using Common Patterns"
the second paragraph |
"Since $RE is a magic hash…" — a magic hash is %RE, not $RE.
|
vdb |
Aug 13, 2026 |
| PDF |
Page page 313, section "Answers for Chapter 2/Exercise 2"
the first code samle |
"my @modules = sort keys $Module::CoreList::version{5.014002};" causes Perl error:
Experimental keys on scalar is now forbidden at ./test.pl line 7.
Type of arg 1 to keys must be hash or array (not hash element) at ./test.pl line 7, near "};"
Execution of ./test.pl aborted due to compilation errors.
Hash reference must be dereferenced:
my @modules = sort keys %{ $Module::CoreList::version{5.014002} };
or
my @modules = sort keys $Module::CoreList::version{5.014002}->%*;
|
vdb |
Aug 13, 2026 |
|
49
5th paragraph |
I am viewing the book online so I don't have real page numbers. I used 49 as a page number; it means chapter 4, section 9: Simplifying Nested Element References with Arrows,
there is a typo. From the text:
The arrow has to be between nonsubscripty things. Why wouldn?t it be between subscripty things? Well, imagine a reference to the array @all_with_names:
Should be:
The arrow has to be between subscripty things. Why wouldn?t it be between nonsubscripty things? Well, imagine a reference to the array @all_with_names:
|
Robert A MacLeod |
Feb 20, 2014 |
| Printed |
Page 124
IO::Pipe first paragraph and code block |
"The | after $command notes ..." text appears above
open my $pipe, '-|', $command
To match the code, the text should be something like
'-|', the second argument to open(), notes ...
|
Gregory Sherman |
Aug 30, 2017 |
| PDF |
Page 143
Sorting with Indicies, first/second blocks of code |
my @sorted = sort qw(Gilligan Skipper Professor Ginger Mary Ann);
print "@sorted\n";
which necessarily results in:
Gilligan Ginger Mary Ann Professor Skipper
would actually print out:
Ann Gilligan Ginger Mary Professor Skipper
It most likely was supposed to be:
my @sorted = sort qw(Gilligan Skipper Professor Ginger Mary-Ann);
print "@sorted\n";
which prints out correctly:
Gilligan Ginger Mary-Ann Professor Skipper
The hyphen in Mary-Ann was lost or was optimized away possibly when it (the text) was converted from the Unicode 'em-dash' and then back into regular code again, just a theory.
|
Gabriel Sharp |
Oct 20, 2014 |
| PDF |
Page 152
Listing for sub dump_data_for_path example |
dump_data_for_path("$path/$_", $directory{$_});
should be
dump_data_for_path("$path/$_", %$data->{$_});
The directory from the sub 'data_for_path' return the %directory as a reference
that gets shifted to $data.
|
shadow1 |
Sep 23, 2014 |
| PDF |
Page 181
first line of page |
When adding modules to using module-starter:
module−starter −−module=Sheep −−dist=.
The problem is, Module::Starter installs (from cpan) the Module::Starter::Simple plugin by default, which does NOT let you add modules into an already created distribution. I found out after hours of looking that the problem is, that there is also a Module::Starter::Smart plugin that DOES do this. The problem is unclear but there is a pretty extensive post on perlmonks:
http://www.perlmonks.org/?node_id=987084 which is where I finally solved the problem, however.
After all that, i finally came up with a full proof way to make it work without problems:
1. Install Module::Maker::Smart from cpan
2.. use the --plugin="Module::Maker::Smart" in your command line
We have tried using 'plugin: Module::Maker::Smart' in the ~/.module-starter/config, but it does not seem to work, probably because there are : which are also used to separate the configuration file's (%config) keys from it's values (read that post for details).
|
Gabriel Sharp |
Oct 27, 2014 |
| PDF |
Page 189
Section Header: "Creating a ExtUtils::Makemaker Distribution" |
The command line, which was in the non-summary part of the book tells us (and I also confirmed it via the docs), that the following line:
% module-starter --builder="ExtUtils::Makemaker" --name="Animal"
should read
% module-starter --builder="ExtUtils::MakeMaker" --dist="Animal"
Note the capital M in Maker which also uncapitalized in the section heading, along with the use of "..ing a ExtUtils::M..." instead of the appropriate "...ing an ExtUtils::M..." (but that's not really "a" big enough deal, but the command line typo, is.).
|
Gabriel Sharp |
Oct 27, 2014 |
| Printed |
Page 214
3rd code snippet |
The line push@{violated{$desc{||=[]}, $.;
produces a syntax error.
|
Patrick Clot |
Feb 10, 2016 |
| PDF |
Page 313
2nd code listing |
The sample output would list Perl release date in the 2nd column not the Perl version.
|
Jozef Reisinger |
Jan 19, 2015 |
|
321
|
Please disregard my previous post, I now found that I looked at the wrong piece of code, mixing the code for Ex. 3 with the one for Ex. 2
Sorry for the noise, please accept my apologies, --Andre
|
Anonymous |
Mar 19, 2015 |