Learning Perl 6

Errata for Learning Perl 6

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
PDF
Page xvi
1st paragraph

the package name is not rakudo-star should have been C:\ choco install rakudostar instead.

Note from the Author or Editor:
Change as noted

hkdtam  Oct 16, 2018 
PDF
Page 8
third code section

There are two code sections that look like this: put 'Hello Perl 6!'; put 'The time is ', now; In the second one, remove the final semicolon: put 'Hello Perl 6!'; put 'The time is ', now

Note from the Author or Editor:
Change as noted

brian d foy  Sep 18, 2018 
Printed
Page 8
last code example

On p8 the bottom example: loop { state $count = 0; sleep 1; print $count, "\r"; } is it perhaps missing a ++? as in: loop { state $count = 0; sleep 1; print $count++, "\r"; } It just seems a little pointless without the ++.

Note from the Author or Editor:
Change as noted

Anonymous  Oct 09, 2018 
Printed
Page 14
bottom of page

p6doc language/variables gives No such type 'language/variables' but p6doc variables seems to give the desired documentation page

Note from the Author or Editor:
Change as noted

Jason Lewis  Oct 07, 2018 
PDF, ePub, Mobi
Page 28
2nd and 3rd paragraph

The phrase "For numbers, 0 is False and everything else is True" appears at the end of the second paragraph, and is repeated at the end of the third. This phrase should only appear once.

Note from the Author or Editor:
Remove the sentence from the second paragraph.

José Joaquín Atria  Sep 07, 2018 
Printed
Page 32
Chapter 2, Section "Chained comparisons"

The variable $n needs to be declared with "my". % perl6 > $n = 10 10 > 7 < $n < 15 ought to be changed to % perl6 > my $n = 10 10 > 7 < $n < 15

Note from the Author or Editor:
Change as noted.

Andreas Vögele  Nov 20, 2018 
PDF, ePub
Page 34
4th code example

Chapter 2, Section "Conditional Branching" (page 34 on the PDF) There's an operator precedence problem on: Some people prefer an if with a negated condition: if ! $number %% 2 { put 'The number is odd'; } Should be either one of: if ! ( $number %% 2 ) {...} if not $number %% 2 {...}

Note from the Author or Editor:
Change to if ! ( $number %% 2 ) {...}

Lucas Buchala  Sep 11, 2018 
PDF, ePub, Mobi
Page 41
3rd code snippet

In the snippet my Int $number; put $number2.^name; # Int the first and the second variable names are different. They should be the same.

Note from the Author or Editor:
change the second variable name to match the first ($number)

José Joaquín Atria  Sep 07, 2018 
Printed
Page 45
3rd paragraph code example

put .numerator, '/', .denominator, ' = ' given $sum; is missing the final printout of $sum maybe should be something like: put .numerator, '/', .denominator, ' = ', $sum given $sum;

Note from the Author or Editor:
Change as noted

Jason Lewis  Oct 10, 2018 
PDF
Page 47
4th code example

I found a typo at the bottom of page 47: It says % perl6 > i*i -1 But if you multiply i*i, you get a Complex number back. You need to coerce it with .Int to get -1: % perl6 > i*i -1+0i > (i*i).Int -1

Note from the Author or Editor:
Change output to: > i*i -1+0i

Packy Anderson  Sep 03, 2018 
PDF
Page 54
7th line of 1st code sample

The book says: > Q :q 「This quote \「\」 escapes」 This quote 「 escapes But it should be: > Q :q 「This quote \「\」 escapes」 This quote 「」 escapes

Note from the Author or Editor:
Change as noted

Packy Anderson  Sep 03, 2018 
PDF
Page 55
7th code sample

put 'hamadryas PERLICUS'.tc; should be put 'hamadryas PERLICUS'.tclc;

Note from the Author or Editor:
Change as noted.

Packy Anderson  Sep 03, 2018 
Printed
Page 56
Line -13

Result is True, not False ( 'Hama...'.fc.starts-with: 'hama' )

Note from the Author or Editor:
In second code example from bottom, change to: > 'Hamadryas perlicus'.fc.starts-with: 'hama' True

Luc St-Louis  Oct 01, 2018 
PDF
Page 60
3rd line of 6th code sample

using the code if $answer { 'You chose <', $answer, '>' } has an interesting side effect. It looks like put do { 'You chose <', $answer, '>' } puts a single space between the arguments: > $answer = ' X '.trim; X > put do { 'You chose <', $answer, '>' } You chose < X > > put 'You chose <', $answer, '>' You chose <X> This makes it look (erroneously) like .trim compresses leading and trailing spaces down to single spaces, not removing them entirely, and yielding the following output when the script is modified to use .trim: % perl6 prompt.p6 What's your favorite animal? Butterfly You chose < Butterfly > An easy way to fix this would be to concatenate them using ~, thus changing the 3rd line of the script to if $answer { 'You chose <' ~ $answer ~ '>' } This way, when the program is changed to use .trim, you get the following result: % perl6 prompt.p6 What's your favorite animal? Butterfly You chose <Butterfly>

Note from the Author or Editor:
Changed as noted

Packy Anderson  Sep 03, 2018 
PDF
Page 99
2nd line of 2nd code sample

The second code sample reads my $countdown = <1 2 3 4 5>.reverse.eager; put $countdown.^name; # Seq put $countdown.elems; # 5 It should read my $countdown = <1 2 3 4 5>.reverse.eager; put $countdown.^name; # List put $countdown.elems; # 5

Note from the Author or Editor:
Change as noted

Packy Anderson  Sep 03, 2018 
PDF
Page 103
Second to last

Some spacing needed in "[POSITION]is a postcircumfix..."

Note from the Author or Editor:
Change as noted

Ukar  Mar 14, 2019 
PDF
Page 111
Fourth code sample

The code sample reads: my $list = ( 1; 'Hamadryas'; 'a', 'b' ); put $list.elems; # 3 say $list; # (1 2 (a b)) put $list.[0].^name; # Int put $list.[1].^name; # Str put $list.[*-1].^name; # List It should read: my $list = ( 1; 'Hamadryas'; 'a', 'b' ); put $list.elems; # 3 say $list; # (1 Hamadryas (a b)) put $list.[0].^name; # Int put $list.[1].^name; # Str put $list.[*-1].^name; # List

Note from the Author or Editor:
Change as noted

Patrick Anderson  Sep 08, 2018 
PDF, ePub, Mobi
Page 114
4th paragraph and code snippet

The page says: Each sublist has three elements: ((1 a 🐈)(2 b 🐇)(3 🐀)) but the last sublist only shows two. It should say Each sublist has three elements: ((1 a 🐈)(2 b 🐇)(3 c 🐀))

Note from the Author or Editor:
Change as noted.

José Joaquín Atria  Sep 07, 2018 
PDF
Page 117
Eighth (final) code sample

The code sample reads my $allomorphs = <137 2i 3/4 a b>; my $int-strs = $allomorphs.grep: IntStr; # (137) my $rat-strs = $allomorphs.grep: RatStr; # (3/4) my $img-strs = $allomorphs.grep: ComplexStr; # (2i) my $strs = $allomorphs.grep: Str; # (a b) But it should read my $allomorphs = <137 2i 3/4 a b>; my $int-strs = $allomorphs.grep: IntStr; # (137) my $rat-strs = $allomorphs.grep: RatStr; # (3/4) my $img-strs = $allomorphs.grep: ComplexStr; # (2i) my $strs = $allomorphs.grep: Str; # (137 2i 3/4 a b)

Note from the Author or Editor:
change as noted.

Packy Anderson  Sep 08, 2018 
PDF
Page 124
1st paragraph

"What’s actually in $result?" should read "What’s actually in $value?"

Note from the Author or Editor:
Change as noted

Packy Anderson  Sep 08, 2018 
Printed
Page 131
try/CATCH code example

Misindented.

Note from the Author or Editor:
Indent like so: Indent like so, with everything inside the try { ... } moved over four spaces: try { CATCH { when X::MyException { put 'Caught a custom error' } } my-own-error(); }

Luc St-Louis  Oct 08, 2018 
PDF
Page 132
First code snippet

The snippet says my $result = do-something(); if $result { ... } my $did-it-work = ?$results; but it should probably say my $result = do-something(); if $result { ... } my $did-it-work = ?$result;

Note from the Author or Editor:
change as noted

José Joaquín Atria  Sep 21, 2018 
PDF
Page 139
5th (last) Paragraph

"It’s probably easiest to represent it as a decimal number" should read "It’s probably easiest to represent it as an octal number"

Note from the Author or Editor:
Change as noted

Packy Anderson  Sep 09, 2018 
Printed
Page 139
Line 10

Misplaced comma in "write, this".

Note from the Author or Editor:
should be "as I write this," in note

Luc St-Louis  Oct 01, 2018 
Other Digital Version
153
1st code section, 2nd line

The comment reads: # ((Any) perlicus Sostrata Junonia) However, 'perlicus' should be removed: # ((Any) Sostrata Junonia)

Note from the Author or Editor:
This is actually on page 105 (Chapter 6, "Changing a Single Element") the third to last code block should read: my $butterflies = ( $, 'Sostrata', 'Junonia' ); say $butterflies; # ((Any) Sostrata Junonia)

Nova Patch  Oct 10, 2018 
Printed
Page 164
Code example at bottom of page (and following page)

The variable names read better as @permissible... instead of @permissable...

Note from the Author or Editor:
Change all instances of @permissable to @permissible

Luc St-Louis  Oct 01, 2018 
Printed
Page 166
Line -10 and following

%color should be %color-name-to-rgb.

Note from the Author or Editor:
Change all instances of %color on that page to %color-name-to-rgb

Luc St-Louis  Oct 01, 2018 
PDF
Page 195
1st code example

multi subsomething ( $a ) { put "One argument"; } multi subsomething ( $a, $b ) { put "Two arguments"; } should read multi sub something ( $a ) { put "One argument"; } multi sub something ( $a, $b ) { put "Two arguments"; }

Note from the Author or Editor:
change as noted

Packy Anderson  Sep 15, 2018 
ePub
Page 203
First sentence

The example on the previous page is: "You call .reverse on a List to flip the list around. When you call List methods it just works: my $countdown = <1 2 3 4 5>.reverse; put $countdown.^name; # Seq put $countdown.elems; # 5” On the next page the first line is "The result isn’t actually a Seq, but in most common cases that isn’t important." I think it should say that the result *IS* actually a Seq.

Note from the Author or Editor:
Change to read "The result is actually a Seq"

N. Dogger  Sep 08, 2018 
Printed
Page 304
Line 3

The '+' should be a '*'.

Note from the Author or Editor:
Change as noted to "3 * 3"

Luc St-Louis  Oct 01, 2018 
PDF
Page 361
Paragraph 6

The current sentence is "This like your basic number-guessing program, but you have to make two sets of comparisons." It should probably be "This is like your basic number-guessing program, but you have to make two sets of comparisons." The word "is" should be added after the word "This".

Note from the Author or Editor:
Change as noted.

Amir Aharoni  Sep 04, 2018 
Other Digital Version
596
Location 596 (Kindle)

sub MAIN ( $thingy1, $thingy2 ) { put '1: ', $thingy1; put '2: ', $thingy1; } You probably intended: sub MAIN ( $thingy1, $thingy2 ) { put '1: ', $thingy1; put '2: ', $thingy2; }

Note from the Author or Editor:
Change as noted

Mark Devine  Sep 04, 2018 
ePub
Page 1582
2nd paragraph (Location 1582 Kindle)

*** In the original: If that’s too restrictive you can set the PATH to exactly the directories that you consider safe: %*ENV<PATH> = '/bin:/sbin'; print Q :x 'hostname'; # does not find this print Q :x '/bin/hostname'; # this works *** Both actually work. Perhaps change the %*ENV<PATH> to make the demonstration valid. If that’s too restrictive you can set the PATH to exactly the directories that you consider safe: %*ENV<PATH> = '/sbin:/usr/local/bin'; print Q :x 'hostname'; # does not find this print Q :x '/bin/hostname'; # this works

Note from the Author or Editor:
change as noted: %*ENV<PATH> = '/sbin:/usr/local/bin';

Mark Devine  Sep 07, 2018 
ePub
Page 1987
Middle of page (Location 1987 Kindle)

Subset::Common *** should be Subsets::Common

Note from the Author or Editor:
Change as noted

Mark Devine  Sep 07, 2018