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
Printed Page 24
first paragraph

Page 24, first paragraph, states, "In the previous exercise, you couldn't specify a hexadecimal number as an argument." My solution to Exercise 2.6 works fine with hexadecimal arguments: 2018-09-27 20:57:27 dpchrist@vstretch ~/src/learningperl6 $ cat /etc/debian_version 9.5 2018-09-27 20:57:38 dpchrist@vstretch ~/src/learningperl6 $ uname -a Linux vstretch 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux 2018-09-27 20:57:47 dpchrist@vstretch ~/src/learningperl6 $ perl6 -v This is Rakudo version 2016.12 built on MoarVM version 2016.12 implementing Perl 6.c. 2018-09-27 20:57:52 dpchrist@vstretch ~/src/learningperl6 $ head -n 12 ex-2.6.p6 #!/usr/bin/env perl6 # $Id: ex-2.6.p6,v 1.2 2018/09/28 03:50:10 dpchrist Exp $ # Per brain d foy, 2018, "Learning Perl 6". # Copyright 2018 by David Paul Christensen dpchrist@holgerdanske.com # Public Domain. sub MAIN ( $number ) { put 'binary : ', $number.base: 2; put 'octal : ', $number.base: 8; put 'decimal : ', $number.base: 10; put 'hexadeciaml: ', $number.base: 16; } 2018-09-27 20:57:57 dpchrist@vstretch ~/src/learningperl6 $ perl6 ex-2.6.p6 0xDEADBEEF binary : 11011110101011011011111011101111 octal : 33653337357 decimal : 3735928559 hexadeciaml: DEADBEEF

David Christensen  Sep 27, 2018 
Printed Page 95
Top of Page: First two lines (descriptive), and first code example

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, Ph.D.  Aug 12, 2019 
PDF Page 109
Second to last

In the sentence "It takes a starting index, a length, and the items to remove from the list." about .splice, doesn't the last parameter in .splice specify the items with which to replace the removed elements? From the doc: multi method splice(Array:D: $start = 0, $elems?, *@replacement --> Array) Deletes $elems elements starting from index $start from the Array, returns them and replaces them by @replacement.

Ukar  Mar 14, 2019 
PDF Page 119
First paragraph, second code sample

You can use these methods together. This selects the even numbers then squares them: my $squares = $allomorphs .grep( { ! .does(Numeric) } ) .map( { $_ %% 2 ?? $_**2 !! |() } ); I have no idea what this is trying to accomplish. Considering that the last example that mentioned $allomorphs made its value the List (137 2i 3/4 a b), trying to run the code above yields: Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏a' (indicated by ⏏) This is because the List $allomorphs is transformed by the .grep into the list ( a b ), and the .map then attempts to square the values 'a' and 'b'. I understand that it's trying to combine .grep and .map, but it's not doing so in any way that makes sense.

Packy Anderson  Sep 08, 2018 
PDF Page 135
Second to last paragraph

The sentence "You can more than one level at a time." seems to be missing some details.

Ukar  Mar 15, 2019 
PDF Page 156
First code snippet in the page

In the code snippet: my Buf $buffer = $fh->read( $count ); the pointy block arrow (->) is used to invoke the `read` method. However, a dot (.) should be used instead.

Ukar  Apr 01, 2019 
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 
Printed Page 324
Top three code examples

Missing comma after $filename (three instances).

Luc St-Louis  Oct 17, 2018 
PDF Page 332
Second to last

operaters -> operators

Ukar  Mar 16, 2019