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
Other Digital Version
N/A
eBook

Reads "Perl 9 tries to fill the gap", but should read "Perl tries to fill the gap". This was reported before, but it shows-up still in my mobi eBook version...

Note from the Author or Editor:
Change as noted.

Andrew Staley  May 09, 2011 
Printed
Page 4
Fifth paragraph, first sentence

Reads "Perl 9 tries to fill the gap", but should read "Perl tries to fill the gap". The 9 did not show up in the original sources or the QCs, but is in the book. Go figure.

brian d foy
brian d foy
O'Reilly AuthorO'Reilly Blogger 
Jul 13, 2008  Oct 01, 2008
Printed
Page 4
Fifth paragraph, first sentence

Reads "Perl 9 tries to fill the gap", but should read "Perl tries to fill the gap". The 9 did not show up in the original sources or the QCs, but is in the book.

Anonymous    Feb 01, 2009
Safari Books Online
7.2.3
3rd code example

Error only visible when using HTML view. Earlier page 111 correction left off the \n in the print statement. $_ = "yabba dabba doo"; if (/y(.)(.)\2\1/) { # matches 'abba' print "It matched a after the y"; }

Note from the Author or Editor:
The line should read: print "It matched a after the y\n";

Anonymous  Jun 13, 2010 
Safari Books Online
9.5.1
9th paragraph (using Safari)

The code " s#(.*)#$1#g; " will delete all of the text, not just the "BOLD" text.

Note from the Author or Editor:
This is also page 142 of the printed edition The regex should in the second code example is missing the HTML tags and should read: s#<BOLD>(.*)</BOLD>#$1#g

Anonymous  Jul 03, 2008  Sep 01, 2009
Printed
Page 12
2nd paragraph (end)

Instead of "The perlfaq2 manpage" it should be "The perlfaq3 manpage" =

Note from the Author or Editor:
Change as noted. It should point to the Programming Tools section of the perlfaq. This is the second paragraph from the top.

Eckhard Stein  Jun 11, 2012 
Safari Books Online
13.14
Exercise #1

The last clause in the paragraph states: "but don't try show the contents."

Note from the Author or Editor:
should read "but don't try to show the contents."

Anonymous  Jul 03, 2008  Feb 01, 2009
Safari Books Online
14.5
Exercise 1, sample data

HTML view: "&#8722;10" in the sample data uses Unicode MINUS SIGN \x{2212} instead of hyphen \x{002D}. If the sample data is copied and pasted for the program's input, Perl complains the argument isn't numeric. Should be "-10" (\x{002D}10) instead of "&#8722;10" (\x{2212}10).

Note from the Author or Editor:
Change as noted, or something equivalent. In source code, I think a literal hyphen instead of an HTML entity might be better.

Anonymous  Jun 24, 2010 
Printed
Page 27
last paragraph of Subsection "Scalar Variables"

The first is on page 27, last paragraph of Subsection "Scalar Variables": There I read Scalar variables in Perl are always referenced with the leading $&. Should this be Scalar variables in Perl are always referenced with the leading $.

Note from the Author or Editor:
fix as reported

Anonymous  Jul 29, 2008  Oct 01, 2008
Printed
Page 27
4th paragraph

"Scalar variables in Perl are always referenced with the leading $&." The "&" must be removed. It's correct in the 'Safari books online' version

Note from the Author or Editor:
Change as noted

Anonymous  Oct 01, 2008  Oct 01, 2008
Printed
Page 27
last paragraph of Subsection "Scalar Variables"

The first is on page 27, last paragraph of Subsection "Scalar Variables": There I read Scalar variables in Perl are always referenced with the leading $&. Should this be Scalar variables in Perl are always referenced with the leading $.

Note from the Author or Editor:
Change as noted.

Anonymous    Feb 01, 2009
Printed
Page 30
the small example

page 30, the small example. If $meat has never recieved a variable, then $barney in $barney = "fred ate a $meat"; has the value "fred ate a " and not "fred ate a", so the trailing " " of the strings should remain?

Note from the Author or Editor:
On the second code second of page 30, the code comment reads $barney is now "fred ate a" it should read $barney is now "fred ate a " with a trailing space

Anonymous  Jul 29, 2008  Oct 01, 2008
Printed
Page 30
the small example

If $meat has never recieved a variable, then $barney in $barney = "fred ate a $meat"; has the value "fred ate a " and not "fred ate a", so the trailing " " of the strings should remain?

Note from the Author or Editor:
Change as noted

Anonymous    Feb 01, 2009
Printed
Page 41
Beginning of first sentence after heading, "List Literals".

"An array (the way you..." should read, "A list literal (the way you..."

Note from the Author or Editor:
Wow. How did that mistake ever get through. Change as noted.

boB Stepp  Sep 24, 2010  Dec 01, 2010
Printed
Page 69
2nd code example

Hello, on page 69 in 2nd code example there is: my($max_so_far) = shift @_; But isn't shift returning scalar? If so parentheses are useless here, aren't they?

Note from the Author or Editor:
Change this line to not use the shift my($max_so_far) = @_;

jirib  Oct 10, 2012 
Printed
Page 85
2nd footnote

``use 5.6'' should read: ``use 5.006''

Note from the Author or Editor:
change as noted

Anonymous  Sep 12, 2008  Sep 01, 2009
Printed
Page 95
paragraph 7, first sentence

``http://www.stonehenge.com'' is not a hostname, ``www.stonehenge.com'' is...

Note from the Author or Editor:
change http://www.stonehenge.com to www.stonehenge.com as noted

Anonymous  Sep 12, 2008  Sep 01, 2009
Printed
Page 105
The csh example of setting an environment variable

the setenv example should not have an = for csh. Instead of: % setenv CHARACTER=Fred It should be: % setenv CHARACTER Fred

Note from the Author or Editor:
Change as noted

Anonymous  Aug 21, 2008  Dec 01, 2010
Printed
Page 111
2nd code snippet

A copy/paste error from the 1st snippet on the same page: The pattern should be /(.)(.)\2\1/, instead of /y(.)(.)\2\1/, and the output message should be something like "It matched a palindrome!\n".

Note from the Author or Editor:
The error isn't in the regex, it's the print statement. In the second example, change the print statement to: print "It matched a after the y"

Anonymous  Sep 17, 2008  Sep 01, 2009
Printed
Page 112
last code example, right above "Alternatives" section heading

Change $_ = "aa11bb"; to $_ = "xaa11bb";

Note from the Author or Editor:
Change as noted

brian d foy
brian d foy
O'Reilly AuthorO'Reilly Blogger 
Sep 19, 2008  Sep 01, 2009
Printed
Page 112
Last pattern-match code snippet

The pattern /(.)(.)\g{-1}11/ will not be matched from the string "aa11bb". However, if the string contained, for example, "aaa11bb", the pattern would be matched. The existing pattern could be modified to /(.)\g{-1}11/ to achieve a match with the existing string: "aa11bb".

Note from the Author or Editor:
This is the last code snippet before the "Alternatives" section in chapter 7. Change the code to read: ------ use 5.010; $_ = "daa11bb"; if (/(.)(.)\g{-1}11/) { print "It matched!\n"; } ----- The change is the addition of the letter "d" at the beginning of "aa11bb".

Duane Klaming  Mar 05, 2009  Sep 01, 2009
Printed
Page 126
Complete "Named Captures" section (pages 126-128)

"Coding conventions" that seem to apply to the rest of the book are not followed in section "Named Captures", i.e closing braces in examples are all indented wrong, tab is 4 whitespaces instead of 2, and no space in between if and opening parenthesis and added single white space after opening parenthesis and before closing parenthesis, e.g. use 5.010; my $names = 'Fred or Barney'; if( $names =~ m/(\w+) and (\w+)/ ) { # won't match say "I saw $1 and $2"; } should be like: use 5.010; my $names = 'Fred or Barney'; if ($names =~ m/(\w+) and (\w+)/) { # won't match say "I saw $1 and $2"; }

Note from the Author or Editor:
This is true, but we're not going to change it for this edition.

Anonymous  Dec 05, 2010 
Printed
Page 127
Last footnote

Last footnote reads: "\k<label> is slightly different than \g{label}. In patterns that have two or more labeled groups with the same label, \k<label> and \g{label} always refers to the leftmost group, but \g{N} can be a relative back reference." First a typo: "refers" should be "refer". Second: There is unsufficient explanation on how \k<label> differs from \g{label}, since \g{N} is not the same as \g{label}, right? Otherwise it should be stated that \g{N} and \g{label} refer to the same thing (i.e. if "N" and "label" are interchangeable).

Note from the Author or Editor:
Change "refers" as noted. As for the level of explanation: it's a footnote. It's not important enough to the discussion to have a longer explanation. I think our note is adequate as long as people understand what we've already put in the main text.

Anonymous  Dec 05, 2010 
Printed
Page 128
last paragraph, second sentence

``This may seem familiar, and for good reason: these automatic memory variables are what the pattern test program (from Chapter 7) was using in its line of "mystery" code, [...]'' That pattern test program is not in chapter 7; it's in chapter 8, four pages after the quoted text above. Thus these automatic match variables don't seem familiar to the first-time-reader... And, BTW, ``chapter'' should not be capitalised in the parentheses ;-)

Note from the Author or Editor:
In the paragraph starting with "The message shows the string..", change the entire paragraph to: The message shows the string as C<(Hello)( there,)( neighbor)>, showing the three automatic match variables in action. We'll show more of those variables in a moment.

Anonymous  Sep 12, 2008  Sep 01, 2009
Printed
Page 130 f.
chapter ``Precedence''

The first paragraph talks about four levels of precedence. But then five levels are listed in the table and in the enumeration following it. Both level 4 and 5 are said to be "the lowest level" there...

Note from the Author or Editor:
Change "4. The lowest level of precedence" to "4. The next-to-lowest level of precedence"

Anonymous  Sep 12, 2008  Sep 01, 2009
Safari Books Online
131
3rd comment

‡ And check out YAPE::Regexp::Explain in CPAN as a regular-expression-to-English translator. the module's name should be YAPE::Regex::Explain

Note from the Author or Editor:
Change as noted.

chenfengyuan  Feb 11, 2010 
Printed
Page 133
Exercise 5

If the input string says "I saw Wilma yesterday", the up-to-five characters are " yest" - including the blank.

Note from the Author or Editor:
The leading space doesn't show itself. Change the sentence to use quotation marks around the string: up-to-five characters are " yest" Note the space immediately after the opening quotation mark.

Mark Galeck  Jun 06, 2010 
Printed
Page 139
2nd code snippet from bottom

fooglue, should be "foo glue" or just glue

Note from the Author or Editor:
Change "fooglue" in code comment to "foo glue"

Mark Galeck  Jun 06, 2010 
Printed
Page 142
First substitution example

The example of a "greedy" star substitution (right after "But what's wrong with it?") is shown as: s#<BOLD>(.*)<BOLD>#$1#g; However, that substitution will NOT match the given text. The second "BOLD" should be "/BOLD": s#<BOLD>(.*)</BOLD>#$1#g;

Note from the Author or Editor:
I think this must be in a printing later than what I have, but the line should read as he says.

Anonymous  Apr 21, 2010 
Printed
Page 142
4th paragraph, it's the first regex on the page.

In the latest edition(5th) on this page, the example provided is: "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; The problem is that the star is greedy[t]. What if the text had said this instead? I thought you said Fred and <BOLD>Velma</BOLD>, not </BOLD>Wilma</BOLD> In that case, the pattern would match from the first <BOLD> to the last </BOLD>, leaving intact the ones in the middle of the line. Oops! Instead, we want a nongreedy quantifier." The problem is NOT just the quantifier, the first regex and the following description saying that it would match the bold tags is incorrect. That regex matches the *whole* string! Here is the following paragraph to clarify my point: "The nongreedy form of star is *?, so the substitution now looks like this: s#<BOLD>(.*?)</BOLD>#$1#g; And it now does the right thing." The point I'm trying to make is that it is clear that <BOLD></BOLD> was intended to be included in the first regex, of which is a major error. The correction would simply be: s#<BOLD>(.*)</BOLD>#$1#g; This is greedy, as the paragraph states, but the tags are included as they should be. Thus, to answer the question: "But what's wrong with it?" to which the answer supplied was "The problem is that the star is greedy." - that is not the only problem! The problem is that the HTML tags were completely left out of the regex! :)

Note from the Author or Editor:
There is missing text. The regex in the second code example on page 142 should be s#<BOLD>(.*)<BOLD>#$1#g;

Anonymous  Aug 18, 2008  Sep 01, 2009
Printed
Page 145
4th paragraph

In the paragraph starting with "Some folks", the last sentence says "...(see the multiple-file rename example in Chapter 14).". Actually it should refer to Chapter 13 (p.197) instead.

Note from the Author or Editor:
Change as noted

Anonymous  Feb 09, 2010 
Printed
Page 165
second to last code example

Change foreach my $try ( 0, undef, '0', 1, 25 ) { to remove the "my" foreach $try ( 0, undef, '0', 1, 25 ) {

Note from the Author or Editor:
Change as noted

brian d foy
brian d foy
O'Reilly AuthorO'Reilly Blogger 
Sep 19, 2008  Sep 01, 2009
Printed
Page 172
first code snippet

should be semicolon at end: use File::Basename; (you always put semicolons in the book, after single lines of code, even though technically they are not needed, but here, if I follow this up with the rest of the code appearing later, hell breaks loose)

Note from the Author or Editor:
Change as noted

Mark Galeck  Jun 12, 2010 
Printed
Page 175
2nd paragraph

'... rather than the double colon we used with moreinfo="none">File::Basename' includes the extraneous markup 'moreinfo="none">'.

Note from the Author or Editor:
change as noted

Anonymous  Sep 21, 2008  Sep 01, 2009
Printed
Page 176
last code example

Change foreach my $param ( param() ) To remove the "my" foreach $param ( param() )

Note from the Author or Editor:
Change as noted

brian d foy
brian d foy
O'Reilly AuthorO'Reilly Blogger 
Sep 19, 2008  Sep 01, 2009
Printed
Page 188
3rd paragraph

On lines 3, 4 and 5, the text "The bitwise operator you'll need to use the bitwise operators. These are the operators that perform binary math operations on values." is interpolated and should be deleted.

Note from the Author or Editor:
Change noted sentences to "The bitwise operators perform binary math operations on values."

Anonymous  Aug 16, 2008  Oct 01, 2008
Printed
Page 188
chapter "Bitwise Operators", first paragraph

Sentences 2 and 4 are identical; sentence 3 is a mixture of sentences 5 and 1. Thus sentences 2 and 3 (or sentences 3 and 4) need to be deleted.

Note from the Author or Editor:
The first paragraph under "Bitwise operators" should read: "When you need to work with numbers bit-by-bit, as when working with the mode bits returned by C<stat>, you'll need to use the bitwise operators. These are the operators that perform binary math operations on values. The bitwise-and operator (C<&>) reports which bits are set in the left argument I<and> in the right argument. For example," After the "For example,", continue as printed

Anonymous  Sep 16, 2008  Feb 01, 2009
Printed
Page 201
4th paragraph, first line

There is a missing space in "ln-s"; it should be "ln -s".

Note from the Author or Editor:
Change as noted

Anonymous  Aug 16, 2008  Oct 01, 2008
Printed
Page 202
first paragraph, last sentence

"it's a symlink, but it doesn't exist" should read "it's a symlink, but the file it references doesn't exist" or similar.

Note from the Author or Editor:
change to "it's a symlink, but its target doesn't exist"

Anonymous  Sep 17, 2008  Sep 01, 2009
Printed
Page 204
4th paragraph, second line

"on directory per call" should be "one directory per call".

Note from the Author or Editor:
Change as noted

Anonymous  Aug 16, 2008  Oct 01, 2008
Printed
Page 204
4th paragraph

"... it can only remove *one* directory per call:"

Note from the Author or Editor:
change "can only remove on directory per call:" to "can only remove one directory per call:" with an "e" after the "on"

Anonymous  Sep 21, 2008  Feb 01, 2009
Printed
Page 206
first paragraph, last line

The text 'moreinfo="none">' at the beginning of the line appears to have been interpolated and should be deleted. Possibly this is a markup command with its leading "<" missing.

Note from the Author or Editor:
Remove the moreinfo="none"> before "stat" on the last line of the first paragraph

Anonymous  Aug 16, 2008  Oct 01, 2008
Printed
Page 206
1st paragraph

'... same type of values returned from the moreinfo="none">stat function ...' includes the extraneous markup 'moreinfo="none">'.

Note from the Author or Editor:
Change as noted

Anonymous  Sep 21, 2008  Feb 01, 2009
Printed
Page 206
section 13.14, Exercise #1

The last clause in the paragraph states: "but don't try show the contents" instead of "try to show"

Anonymous    Feb 01, 2009
Printed
Page 219
Code above Exercises

The code doesn't sort correctly. In it family_name 'a' is compared to itself, and personal_name 'a' is being compared to family_name 'b'. $family_name{$a} cmp $family_name{$a} or $personal_name{$a} cmp $family_name{$b} or should be: $family_name{$a} cmp $family_name{$b} or $personal_name{$a} cmp $personal_name{$b} or

Note from the Author or Editor:
Change as noted

Rose Roberts  May 19, 2009  Sep 01, 2009
Printed
Page 227
Example, bottom of page

When discussing fallthroughs in given/when statements, it appears the bottom example on p227 does not behave as expected. e.g. if the program is run as $ ./fallthroughs.pl Frederick Then we get the output: Name has fred in it Name starts with Fred I don't see a Fred Which seems rather self contradictory. Note that this was also a problem in perlsyn.pod (http://perldoc.perl.org/perlsyn.html - see fallthrough example) and has now been patched in the latest perl 5 development tree (see thread on http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2008-03/msg00375.html) Regards Martin

Note from the Author or Editor:
This was indeed a documentation problem. I figured the docs would be right and perl would change, but they ended up changing the docs. This isn't just a problem, then, with the last example on page 227. The example can also be: use 5.010; given( $ARGV[0] ) { when( 'Fred' ) { say 'Name is Fred'; continue } when( /^Fred/ ) { say 'Name starts with Fred'; continue } when( /fred/i ) { say 'Name has fred in it'; } default { say "I don't see a Fred" } }

Martin Jackson  May 24, 2009 
Printed
Page 227
bottom example

As Michael already stated in his unconfirmed errata, running the bottom example with Frederick as argument does a fall-through right down to the default case. This happens since the argument begins with Fred and the check is continued after matching to both fred and ^Fred, Frederick isn't equal to Fred so we continue to the default. A change of logic might be good in this case, the best case would be to find Fred, if we can't we'd settle for Frederick, and if that's not possible just having fred would be OK. use 5.010; given( $ARGV[0] ) { when( $_ ~~ 'Fred' ) { say 'Name is Fred'; continue } when( $_ ~~ /^Fred/ ) { say 'Name starts with Fred';continue } when( $_ ~~ /fred/i ) { say 'Name has fred in it'; } default { say "I don't see a Fred" } } Staying with the logic of your example, one could also "unless /fred/i" at the end of the default's say.

Note from the Author or Editor:
This is basically how I'm rewriting all the Fred examples.

Tarik Ku  Sep 10, 2009 
Printed
Page 228
bottom code example

Code example bottom of page 228 Leaning Perl 5th edition printing July 2008. The text "say 'Not a number!'" indicates that the first "when" statement is intended to catch input that is not a number while the next three statements indicate that a number is greater than 10, less than 10, or equal to 10. I am confused by the pattern used as this appears to verify that the input is a number. I suspect that negation should have been used, in which case the "#smart" comment would no longer be correct I think. I am a Perl Novice, so perhaps I am failing to completely understand this.

Note from the Author or Editor:
The first when() looks like: when( /^-?\d+\.\d+$/ ) { #smart That should have a negating ! in front of the match operator: when( ! /^-?\d+\.\d+$/ ) { #smart

Dale Mosby  Feb 23, 2010 
Printed
Page 229
second when statement on the second example

The books says when( ! /fred/i } { #dumb ~ => this should be a ,,)'' and not a ,,}'' It is a syntax error.

Note from the Author or Editor:
Change as noted

Anonymous  Sep 19, 2008  Sep 01, 2009
Safari Books Online
231
Exercise 4

The code example does not match with the same subroutine given in the Appendix. The $_ in the loop should be changed to a $number.

Note from the Author or Editor:
The $_ in the divisor subroutine in the exercise description on page 231 should be $number.

zmughal  May 17, 2010 
Printed
Page 231
code sample in exercise 4

Change the line with foreach, which is missing a parenthesis. The new line should be have a left parenthesis after the .. foreach my $divisor ( 2 .. ( $number/2 ) ) {

Note from the Author or Editor:
Change as noted

brian d foy
brian d foy
O'Reilly AuthorO'Reilly Blogger 
Sep 19, 2008  Sep 01, 2009
PDF
Page 234
5th paragraph

It says that the shell doesn't get involved in the earlier commands as in perl -e "system 'ls -l $HOME';" which is wrong since $HOME is passed to bash as it is not written as perl -e 'system "ls -l $ENV{'HOME'}";' where Perl has inherited the path of $HOME. Quote: When the command is “simple enough,” no shell gets involved, so for the date and ls commands earlier, the requested command is launched directly by Perl, which searches the inherited PATH‡ to find the command, if necessary. But if there’s anything weird in the string (such as shell metacharacters like the dollar sign, semicolon, or vertical bar), then the standard Bourne Shell (/bin/sh&#8214;) gets invoked to work through the complicated stuff.

Note from the Author or Editor:
We could explain this more. That $HOME is the shell's version.

Anonymous  Nov 22, 2010 
Printed
Page 271
answer to exercise 6

"+" quantifier is unneeded in /\s+$/ expression because we need only to "prints out any input line ending with whitespace" so we can simply match only one whitespace.

Note from the Author or Editor:
The /\s+$/ doesn't really hurt anything, but it's something we can change later. There's no difference in how the program behaves.

Ivan Goncharov  Aug 06, 2010 
Printed
Page 272
Line 6

Says: "we put the longer value in $longer." Should say: "we put the longer value in $longest."

Note from the Author or Editor:
This is the final line in the first body paragraph on page 272. That's the last exercise answer for chapter 6.

Eric Hosey  Mar 16, 2010 
Printed
Page 275
Exercise 2

In the solution to Ch. 9, exercise 2: Three (3) unless loop control structures are used. However, the unless loop is not introduced until Chapter 10. One could use: if ( ! defined $in ) { for example, instead of unless ( defined $in ) {

Anonymous  Apr 21, 2010 
Safari Books Online
278
last paragraph

$ENV{$key} ? $ENV{$key} : "(undefined)"; should be: defined $ENV{$key} ? $ENV{$key} : "(undefined)";

Note from the Author or Editor:
Change as noted.

chenfengyuan  Feb 12, 2010 
PDF
Page 286
answer for exercises 3 of chapter 14

The answer program in Appendix A for exercises 3 of chapter 14 is under here: print "Please enter a string: "; chomp(my $string = <STDIN>); print "Please enter a substring: "; chomp(my $sub = <STDIN>); my @places; for (my $pos = &#8722;1; ; ) { # tricky use of three-part for loop $pos = index($string, $sub, $pos + 1); # find next position last if $pos == &#8722;1; push @places, $pos; } print "Locations of '$sub' in '$string' were: @places\n"; When variable $sub is NULL or empty, the loop will run infinitely. I think that's because the builtin function index, when the second parameter is NULL or empty,this function will never give -1 as return value,it always return a positive value(between 0 and the length of the first parameter of it). I think it's just the function's behavior. So the programs using this function should consider this condition.

Note from the Author or Editor:
We should check that the inputs to ensure they are sane, but in Learning Perl we typically dispense with that to avoid the distraction. That being said, this is an opportunity to point out the odd behavior of index() at either end of the string. Thanks,

Will Sun  Mar 29, 2011 
Printed
Page 289
answer to excercise 2 (chapter 15)

The excercise asks to print "Fizz", "Bin" and "Sausage", but the answer prints "fizz", "buzz" and "sausage" (Bin vs buzz, and also note the case...).

Note from the Author or Editor:
Change ' buzz' to ' bin', as noted

Anonymous  Sep 22, 2008  Sep 01, 2009
Printed
Page 290
United States

In Learning Perl 5th Edition, the example answer for chapter 15 exercise 5 gives wrong results. If I run it as "./ch15-5.pl 84", it says the number 84 is odd, even though it spits out the correct list of divisors. [mnelson@seahunt perl]$ ./ch15-5.pl 84 Checking the number < 84 > 84 is odd 84 is divisible by 2 3 4 6 7 12 14 21 28 42 I am on Fedora 15 Linux, running perl 5, version 14, subversion 1 (v5.14.1)

Note from the Author or Editor:
The behavior of the smart matched changed after the fifth edition of Learning Perl came out. Afterward, the smart match was no longer commutative (a huge mistake now), so you now have to put the scalar first (2 ~~ @divisors). If you are using Perl 5.10.0, the code in the exercise should work. If you use anything later, it will fail.

Michael Nelson  Nov 11, 2011 
Printed
Page 295
2nd paragraph line 3 and 3rd paragraph line 1

"also know as" instead of "also known as"

Note from the Author or Editor:
Change as noted. This is in Appendix B in the second paragraph.

Tarik Ku  Sep 12, 2009