postderef in 5.20

    use v5.20;
    use experimental 'postderef';
    use DDP;

‘a’, ‘b’, ‘c’ .. ‘z’

    my $items = [ 'a' .. 'z' ];

deref get a whole array;

a; b; c; d; … x; y; z

    say( join '; ', @$items );
    say( join '; ', $items->@* );    # same

get a value by index;

    say $$items[1];                  # 'b'
    say $items->[1];                 # 'b'

get multi value by indexes;

    say( join ';', @$items[ 2,   3 ] );    # 'b; c'
    say( join ';', $items->@[ 2, 3 ] );    # 'b; c'

“get the largest index in a array”;

25

    say $items->$#*;

25

    say $#$items;

“get index and value”;

this is postfix slicing.

    my %hash_norm = %$items[ 2, 3 ];

same here

    my %hash_postdef = $items->%[ 2, 3 ];

{ 2 => ‘c’ , 3 => ‘d’ }

    p %hash_norm;

{ 2 => ‘c’ , 3 => ‘d’ }

    p %hash_postdef;
h