The perl6 equivalent is the Pair type and its constructor operator is =>. They are immutable - once created the key and value can't be changed;
$ perl6
> my $destination = "Name" => "Sydney" ;
Name => Sydney
> say $destination.WHAT ;
(Pair)
> $destination.value = "London";
Cannot modify an immutable Str
in block <unit> at <unknown file> line 1
>
Like the "fat comma" from perl5, the constructor doesn't require the left-hand side to be quoted if it's a single identifier. There is an alternative syntax for expressing Pairs called "colon pair". You can collect a number of Pairs togeather into a list but they will only be accessible positionaly;
> $destination = ( Name => "Sydney" , :Direction("East") , :Miles(420) );
(Name => Sydney Direction => East Miles => 420)
> say $destination.WHAT ;
(List)
> say $destination[1] ;
Direction => East
>
There are convenient variants of the colon pair syntax - if the value is a string, you can replace the parentheses with angle brackets and drop the quotes. If the value is an integer, you can list the key immediately after the value without quotes. If the value is boolean, you can list the key alone if the value is True or prefixed with !
if the value is False.
Finally, you can assign a number of them into a hash where the values can be accessed by key and are mutable;
> my %destination = ( :Name<Sydney> , :Direction<East> , :420miles , :!visited ) ;
Direction => East, Name => Sydney, miles => 420, visited => False
> say %destination<miles> ;
420
> %destination<visited> = True ;
True
>