Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by b2gills (Novice)
on Oct 17, 2017 at 16:12 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1201512]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-23 12:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found