Intermediate Perl

Errata for Intermediate 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 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 
Printed Page 70
second example

The code shown is exactly what is produced by Data::Dumper, but it will not restore the original structures correctly. The error is in the module Data::Dumper. Refer bug report

Bill Smith  May 19, 2017 
Printed Page 214
3rd code snippet

The line push@{violated{$desc{||=[]}, $.; produces a syntax error.

Patrick Clot  Feb 10, 2016 
Safari Books Online 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 
Safari Books Online 321
second code section

Hello dear author(s), I believe that the code provided in the exercise answer is not doing exactly what the exercises requests. It does not sort according to this rule: " The result should be that the machine that sent the most data will be the first source machine in the list, and the first destination should be the machine to which it sent the most data." Here is code that in my opinion does what was requested: open (COCONET, "./coconet.dat") ; my %total_bytes; while (<COCONET>) { next if /^s*#/; my ($source, $destination, $bytes) = split; $total_bytes{$source}{$destination} += $bytes; } my %source_total_bytes; # intermedite hash for my $source (sort keys %total_bytes) { for my $destination (sort keys %{ $total_bytes{$source} }) { $total_bytes{$source}{total} += $total_bytes{$source}{$destination}; } $source_total_bytes{$source} = $total_bytes{$source}{total}; } for my $source (sort { $source_total_bytes{$b} <=> $source_total_bytes{$a} } keys %source_total_bytes) { for my $destination (sort { $total_bytes{$source}{$b} <=> $total_bytes{$source}{$a} } keys %{ $total_bytes{$source} }) { print "$source => $destination: $total_bytes{$source}{$destination} bytes\n"; } print "\n"; } Thanks, --Andre

Anonymous  Mar 19, 2015 
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 
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: 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 " a ExtUtils::M..." instead of the appropriate " an ExtUtils::M..." (but that's not really "a" big enough deal, but the command line typo, is.).

Gabriel Sharp  Oct 27, 2014 
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 
Safari Books Online 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 wouldnt 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 wouldnt it be between nonsubscripty things? Well, imagine a reference to the array @all_with_names:

Robert A MacLeod  Feb 20, 2014