This article has corrections and comments to my «Easy as Six» talk at PerlCon 2019 in Riga. I'll keep it updated.
«say» was introduced in Perl 5 version 5.10, but must be enabled with one of these:
use feature 'say'
use v5.10
(or any higher version number)
CORE::say "12"
«get» isn't available in Perl 5.
The example doesn't make sense in Perl 6 (which has the «get» function), as the newline has already been removed.
The correct Perl 5 code is:
chomp(my $a = <>);
Or this, if we are paranoid:
chomp(my $a =<STDIN>);
If you do run the code on the slide in Perl 5, you get a funny result; $a is assigned the value "get". Certainly not what I anticipated...
The same issue with «get» as on the previous page.
The correct Perl 5 code is:
chomp(my $name = <>);
Remove the trailing «;» on the «while» line:
while (my $line = <$fh>)
The Perl 6 code should use «$_»:
do-something($_) for "filename".IO.lines;
It is correct that «you cannot bind to an array (@values)», but assignment works:
my @values = 1 ... Inf;
It is possible to specify the rule for calculating the next value.
The Show Off Example is the Fibonacci Sequence, where the two first numbers are 0 and 1, and after that any given number is the sum of the two numbers before it in the sequence.
Using placeholder variables:
my $fibs := (0, 1, { $^a + $^b } ... *);
Even more compact (but also quite unreadable):
my $fibs := (0, 1, * + * ... *);
Any operator will do, and multiplication looks really nice (in an obfuscated way):
my $something := (1, 2, * * * ... *);
say $something[^10];
(1 2 2 4 8 32 256 8192 2097152 17179869184)