Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl6
- use v6;
- #`(
- This is Rakudo version 2016.11-170-gc4a60110e built on MoarVM version 2016.11-41-gd2139b52
- implementing Perl 6.c.
- )
- my $key = 'foo';
- my %hash;
- %hash.append($key, $_) for <bar baz>;
- dd %hash;
- # Hash %hash = {:foo($["bar", "baz"])}
- say "\nBraces with string:";
- dd %hash{'foo'};
- # Array %hash = $["bar", "baz"]
- say "\nChevrons, 1 word:";
- dd %hash<foo>;
- # Array %hash = $["bar", "baz"]
- say "\nBraces with var:";
- dd %hash{$key};
- # Array %hash = $["bar", "baz"]
- say "\nGuillemets, 1 var:";
- dd %hash«$key»;
- # ($["bar", "baz"],)
- say "\nBraces with var + comma:";
- dd %hash{$key,};
- # ($["bar", "baz"],)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement