Simply Perl 6

Duration: Hopefully, 60 minute-ish :)

Juerd <juerd@cpan.org>
Perl 5 is hard.

Perl 6 is hard.

You are smart.
You are lazy.
The dot operator:

-> becomes .
my $bar = \@foo;        # Perl 5
print $bar->[5], "\n";
my $bar = \@foo;        # Perl 6
print $bar.[5], "\n";
my $bar = @foo;
print $bar.[5], "\n";
my $bar = @foo;
say $bar.[5];
my $bar = @foo;
say $bar[5];
my $bar = @foo;
say $bar[5];  # Not related to @bar!
my @xyzzy = (42, 15, 123);
say @xyzzy[2];  # 123\n
my @xyzzy = 42, 15, 123;
say @xyzzy[2];  # 123\n
my @xyzzy = 42, 15, 123;


grep { $_ == 15 }, @xyzzy;
my @xyzzy = 42, 15, 123;


@xyzzy ~~ 15; # true
my @xyzzy = 42, 15, 123;


@xyzzy ~~ 16; # false
$string ~~ /regex/;
=~ is gone!

Or was that ~=...
grammar POD {
    token document {
        <paragraph>*
    }
    token paragraph {
        <verbatim> | <command> | <ordinary>
    }
    token verbatim {
        (<ws> .*?) <?par_end>
    }
    token command {
        =<command_name> <?ws> <text> <?par_end>
    }


... }
my $tree 
    = $pod ~~ /<POD::document>/;
Perl 6 code is also parsed this way!
Perl 6 is written in Perl 6!
Overwhelmed?

Let's get back to the simple stuff :)
sub hello ($what) {
    say "Hello, { ucfirst $what }!";
}


hello 'world';
sub hello ($what) {
    say "Hello, { $what.ucfirst }!";
}


hello 'world';
sub hello ($what = 'world') {
    say "Hello, { ucfirst $what }!";
}


hello 'austria'; # Hello, Austria! hello; # Hello, World!
hello what => 'austria';


hello :what('austria');
sub hello (:$what = 'world') { 
    ...
}


hello 'world'; # Error!
say hello (@what) {
    for @what -> $what {
        say "Hello, { $what.ucfirst }!";
    }
}
say hello (@what) {
    for @what {
        say "Hello, { $_.ucfirst }!";
    }
}
say hello (@what) {
    for @what {
        say "Hello, { .ucfirst }!";
    }
}
say hello (@what) {
    say "Hello, { .ucfirst }!" for @what;
}


my @places = qw(austria world); hello @places;
say hello (@what) {
    say "Hello, { .ucfirst }!" for @what;
}


my @places = <austria world>; hello @places;
say hello (@what) {
    say "Hello, { .ucfirst }!" for @what;
}


hello <austria world>; # Error!
say hello (*@what) {
    say "Hello, { .ucfirst }!" for @what;
}


hello <austria world>; # Works!
sub foo { ... }
really means
sub foo (*@_) { ... }
sub foo {
    my ($bar, $quux) = @_;
    ...
}
my $index = 0;
for @items -> $item {
    say "{ $index++ } => $item";
    ...
}
my $index = 0;
for @items -> $item {
    say "{ $index++ } => $item";
    ...
    debug "Done with $index";  # bug!
}
for each(@items; 0..@items.last)
 -> $item, $index {


say "$index => $item"; ... debug "Done with $index"; }
for each(@items; 0..Inf)
    -> $item, $index {


say "$index => $item"; ... debug "Done with $index"; }
for each(@items; 0..*)
    -> $item, $index {


say "$index => $item"; ... debug "Done with $index"; }
* is "whatever".

Can be
Inf (infinity)
→ Random
→ Everything
→ ...

Whatever makes sense for the operator or sub you're using.
With...It means...
1..*Inf
'a'..*zzzzzzzz...
@foo[*]All elements
your subwhat you want it to mean
sub hex_color ($name) {
    ▼ switch construct
    given $name {
        when 'red'   { return '#ff0000' }
        when 'green' { return '#00ff00' }
        when 'blue'  { return '#0000ff' }
             ▼ "whatever" operator
        when * {       ▼ concatenation operator
            return '#' ~ { any(0..9, 'a'..'f').pick } x 6;
                           ▲_____junction____▲
                         ▲__________closure_________▲
        }
        ▼ flexible croaking
        fail "Color '$name' unknown";
    }
}