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
PDF Page 311
3rd paragraph, the code

@ARGV = sort keys %do_these; $^I = '.bak'; if (@ARGV) { # <<<<< the added line while (<>) { if (/\A#!/) { # Is it the shabang line? $_ .= "## Copyright (C) $date[5] by Saoud Salah. ##\n"; } print; } } Without this test, if you enter a list composed only of files already containing the Copyright line, the program will prompt you input something, rather exit which the expect behavior.

Saoud Salah  Sep 20, 2014 
PDF Page 149
paragraph last

Perl 5 has been written as Per l5

Anonymous  Aug 15, 2014 
Printed, PDF Page 131

At the end of Chapter 7, in the second paragraph within the 'Negating the Shortcuts' subsection, this text makes an uninvited intrusion to the text: "That means that you could now use /[0-9A-F]+/i to match hexadecimal (base 16) numbers, which use letters ABCDEF (or the same letters in lowercase) as additional digits." It seems to me that these little lines of text have wandered off from Chapter 8, specifically from the subsection to where I'm sure it really belongs: 'Case-Insensitive Matching'. Actually, that Section had suspiciously little to say about the '/i' modifier in Perl and, if you just paste this text right at the end of the subsection, the feature's purpose becomes much more agreeable.

darkrathamantis  Aug 09, 2014 
Printed Page 78
3rd paragraph in Exercises (Exercise 1)

In this exercise the following line my $user_total = total(<STDIN>) is used. It would be helpful to point out that <STDIN> is evaluated in a list context and will therefor supply a list of all entered lines until something like e.g. Control d is pressed.

Eckhard Stein  Aug 03, 2014 
Printed Page 56
2nd paragraph

The * in 2*3 is numeric multiplication, while the x in <2x3> is string replication. The first gives you 8 .... Should be 6 instead of 8. This error has already been reported for the pdf Format.

Eckhard Stein  Jun 12, 2014 
Printed Page 65
towards bottom of page

On page 65, towards the bottom, you have the sentence: "You normally take in those sorts of statements when you’re ready to deploy your program." I think perhaps you meant to say "take OUT".

Anonymous  May 19, 2014 
Printed Page 55

You use lexical (my) variables in a code example on page 55 (The each Operator) but you only formally introduce this concept on page 71. and You use "say" for output in a code example on page 55 (The each Operator) but you only formally introduce this concept on page 102.

Anonymous  May 19, 2014 
PDF Page 320
Exercise 1. Chapter 14, the code

Hi, Running the code together with the sample data provided in the exercise 14.1 at page 246 I get this warning: Argument "M-bM-\0M-^S10" isn't numeric in sort at ./ex14.1.pl line 6, <> line 1. I run perl 5.14 on Ubuntu with use strict and warnings on. The warning appears only because of the negative value in the list; as soon as I removed it all is ok. Bests, Lian

Anonymous  Oct 02, 2013 
Safari Books Online 18

"(...) or via a piped open, which you’ll see in Chapter 14." correct version is: "(...) or via a piped open, which you’ll see in Chapter 16."

Grzegorz Szpetkowski  Jun 05, 2013 
PDF, ePub, Mobi, Safari Books Online Page 12
last paragraph

"PFE (Programmer's Favorite Editor)" should be "PFE (Programmer's File Editor)" http://www.lancs.ac.uk/staff/steveb/cpaap/pfe/

Tim Hofsommer  Apr 30, 2013 
Safari Books Online 149
second paragraph from the bottom of page

The text of the book says the following: <begin clip from book> For example, suppose you had some HTML-like text, and you want to remove all of the tags <BOLD> and </BOLD>, leaving their contents intact. Here's the text: I'm talking about the cartoon with Fred and <BOLD>Wilma</BOLD>! And here's a substitution to remove those tags. But what's wrong with it? s#(.*)#$1#g; <end clip from book> That pattern won't replace the BOLD tags. Given what is written further on to demonstrate a non-greedy asterisk quantifier: s#<BOLD>(.*?)</BOLD>#$1#g; I am guessing that the original pattern was meant to be the following which uses a greedy asterisk quantifier: s#<BOLD>(.*)</BOLD>#$1#g;

Anonymous  Apr 03, 2013 
Printed Page 185
6th paragraph and following code snippet

The text in paragraph 6 implies if and only if the environment variable 'VERBOSE' is set the code snippet below will print a message, but the code snippet assigns '1' if the environment variable is not set, which ends up evaluating to true and printing the message.

Anonymous  Mar 26, 2013 
PDF Page 351
1st code

foreach my $arg ( @ARGV ) { push @new_ARGV, decode $codeset, $_; } should be foreach my $arg ( @ARGV ) { push @new_ARGV, decode $codeset, $arg; } or foreach ( @ARGV ) { push @new_ARGV, decode $codeset, $_; }

Masayuki Kamimura  Mar 16, 2013 
PDF Page 335
2nd paragraph, 1st sentence

This is the sentence: "In Chapter 16, we mentioned the map and grep list-processing operators." Change "Chapter 16" to "Chapter 17".

André Philipp  Mar 04, 2013 
PDF Page 269
5th paragraph, 1st sentence

This is the sentence: "The pipe opens can also take more than three commands." Change "commands" to "arguments".

André Philipp  Mar 03, 2013 
PDF Page 317, 318
Chap 13 Ex 1,2,3

This is the code section: chomp(my $dir = <STDIN>); if ($dir =~ /\A\s*\Z/) { # A blank line Because there will never be a newline after the end-of-string anchor, change "\Z" to "\z": chomp(my $dir = <STDIN>); if ($dir =~ /\A\s*\z/) { # A blank line

André Philipp  Feb 20, 2013 
PDF Page 140
2nd paragraph

Change all instances of "\z" to "\Z".

André Philipp  Jan 31, 2013 
PDF Page 89
1st footnote

Change "zero or one arguments" to "zero or one argument".

André Philipp  Jan 21, 2013 
PDF Page 71
6th paragraph

This is the text: "you can't have two lexical variables with the same name declared in the same scope" When I test this, the code runs and I only get a warning that a "my" variable masks an earlier declaration in the same scope. Therefore isn't the above text incorrect?

André Philipp  Jan 18, 2013 
PDF Page 104
5th code example, 1st line

This is the line: print { $rock_fh }; # uses $_ by default According to the documentation, only a real filehandle like FH can be used alone to print the contents of $_. Using an indirect filehandle as seen in this example gives a syntax error.

André Philipp  Jan 13, 2013 
PDF Page 34
3rd code example

This is the code example: $code_point = ord( '&#1488;' ); If you look closely, the closing quote, the closing parenthesis, and the semicolon are of a different font than the beginning.

André Philipp  Jan 11, 2013 
Printed, PDF, ePub Page 132
Exercise 5

Text is "Make a program that prints each line that has a two of the same nonwhitespace characters next to each other." The "a" before "two" should be removed.

Paul Trost  Nov 27, 2012