Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: [Perl6] Perl 6 discoveries IV, hash access

by b2gills (Novice)
on Oct 17, 2017 at 16:12 UTC ( #1201512=note: print w/replies, xml ) Need Help??


in reply to [Perl6] Perl 6 discoveries IV, hash access

%hash<b> is short for %hash{<b>} which is short for %hash{qw<b>}
There is also %hash«b» / %hash<<b>> which is similarly short for %hash{«b»} / %hash{qqww«b»}

With that knowledge it should be easy to see why %hash<$somekey> would be the same as %hash{'$somekey'}.

use v6.c; my %hash = ( :a<A>, :b<B>, 'c d' => 'C~D', 'a b' => 'A~B', '$somekey' => '?' ); my $somekey = 'a b'; say %hash« $somekey 'c d' ».perl; # ("A", "B", "C~D") say %hash« '$somekey' ».perl; # "?" say %hash« "$somekey" ».perl; # "A~B" say %hash< $somekey >.perl; # "?"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1201512]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2021-05-06 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (81 votes). Check out past polls.

    Notices?