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.

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
Safari Books Online ?
Chapter 15, section “”Substitutions”, 3rd code block

I don’t have a page number because I’m reading on O’reilly Safari. The code sample after the text “Use the :g adverb to make all possible substitutions” does not actually show any use of use :g, though the claimed result would require it.

Thom Boyer  Jul 02, 2020 
Safari Books Online ?
Table 16-1, entry for `??`

The ?? quantifier is described as having the meaning "Zero b's (a trivial case)". This is incorrect. `b??` means "One or zero b's, with zero preferred". In the following example, b?? matches a `b`, but only when required to because the following regex can't soak up all the `b`'s: > my @s = <ac abc abbc abbbc>; [ac abc abbc abbbc] > for @s { say "match $_:", m/ a (b??) (b **1..2) c/ } match ac:Nil match abc:「abc」 0 => 「」 1 => 「b」 match abbc:「abbc」 0 => 「」 1 => 「bb」 match abbbc:「abbbc」 0 => 「b」 1 => 「bb」

Thom Boyer  Jul 02, 2020 
Safari Books Online ?
Table 16-1, last three rows

The last three rows are intended to cover the `:` ratchet operator. The "Quantifier" column is correct, but in each of these rows the "Example" column has a `?` quantifier modifier instead of `:`. Also, in the fourth line from the botom, `b?:` is given the Meaning "Zero or more b's without backtracking." That should be "Zero or one b's without backtracking". Though it probably means "One b (a trivial case)".

Thom Boyer  Jul 03, 2020 
Safari Books Online ?
Chapter 16, section "Surrounders and Separators"

This sentence is incorrect: "This is automatically nongreedy; it does not grab everything until the last closing parenthesis:", and the example that sentence does not demonstrate non-greediness, it only demonstrates that `\w+` does not match non-word characters. This example shows that `~` does not make its right-hand operand non-greedy: > my $line = 'outside (pupa) space (pupa) outside'; outside (pupa) space (pupa) outside > say $line ~~ m/ '(' ~ ')' .+ /; 「(pupa) space (pupa)」

Thom Boyer  Jul 04, 2020 
Printed Page 20
first sub

put '2: ', $thingy1 - should be $thingy2

David White  Feb 23, 2021 
Printed Page 65
4th code snipppet

Sample output missing escaped $. answer is: ... should be $answer is:

David White  Mar 03, 2021 
Printed Page 94
page 94 (bottom) and page 95 (whole page)

The examples on page 94 (bottom) and page 95 (whole page) describe the use of the 'lines()' routine. While the code example on page 94 on the lower half of the page works, (section entitled, "Reading lines of input"), the code example on the top of page 95 does not work as described. Specifically, the text says, "The lines routine can take an argument that tells it how many lines to grab:" Code example page 95 (top): for lines(17) { put "Got line $_"; } Instead of grabbing the first 17 lines of an input file, running the above code will output the string below (no quotes): "Got line 17" I refer the author to the Perl6 Documentation for recent updates to the 'lines()' routine: https://docs.perl6.org/routine/lines

William Michels  Aug 18, 2020 
PDF Page 115
The code line above section "Hash Functions"

$hash{ bar.foo } = 1; # that's the key 'foobar' should be $hash{ foo.bar } = 1; # that's the key 'foobar'

Wan Ning  Apr 01, 2020 
PDF Page 137
last paragraph

U+0OBC should be U+00BC

Wan Ning  Apr 08, 2020 
PDF Page 147
last paragraph before section "The Automatic Match Variables"

The closing angle bracket (>) is missing. \k<label should be \k<label>

Wan Ning  Apr 13, 2020 
PDF Page 163
1st code example

The example if $color-name-to-rgb{$color}:exists { $color-name-to-rgb{$color} = '22DD22'; } shows a value in a Map being written to. When this is executed, you get the error Cannot modify an immutable Str (00FF00)

Packy Anderson  Sep 15, 2018 
PDF Page 241
Examples of supersets above the Table 14-2

The 4 results of the set comparison seems to be: True True False False

Ruey-Cherng Yu  Nov 02, 2020 
PDF Page 261
first example

There is no :g adverb in the example .

Ruey-Cherng Yu  Nov 02, 2020 
PDF Page 268
second from the last and third from the last in Table 16-1

There is no backtracking : modifier in these two examples in table 16-1 .

Ruey-Cherng Yu  Nov 02, 2020 
PDF Page 289
5th line and 6th line from the last

It seems like the $result match the grammar so it is "Matched" not "failed".

Ruey-Cherng Yu  Nov 06, 2020 
PDF Page 290
Last line of the fisrt example

It seems like the $number match the grammar so it is "Matched" not "failed".

Ruey-Cherng Yu  Nov 06, 2020 
PDF Page 293
Second line of the second example

Is it " method TOP ($/){ " ?

Ruey-Cherng Yu  Nov 06, 2020 
Printed Page 351
Chapter 2, Exercise 2

I'm guessing you want put '3: ', $thingy3; If so, need to update sample outputs on page 352.

David White  Feb 23, 2021 
Printed Page 375
Code Example for Exercise 6.15

In the $block statement of this solution the indexing of the second comparison is wrong. It should rather be: $s.index( $^a.[1] ) <=> $s.index( $^b.[1] ) instead of the current $s.index( $^a.[0] ) <=> $s.index( $^b.[0] ) which sometimes throws an error.

Anonymous  Aug 24, 2020