September 2017
Beginner
402 pages
9h 52m
English
The next group of operators include { }, < >, << >>, and « ».
The main operator { } is used to access values of a hash.
my %h = alpha => 'a', beta => 'b', gamma => 'c';say %h{'beta'}; # b
Similar to the [ ] operator, multiple keys are accepted by { }:
say %h{'alpha', 'beta'}; # (a b)
In previous examples, keys of the %h were quoted. The postcircumfix operator, < >, allows us to avoid quoting in the manner the < > circumfix does:
say %h<beta>; # bsay %h<alpha beta>; # (a b)
The << >> operator and its Unicode synonym, « », interpolate the operands as if they are strings in double quotes, as you can see here:
my $name = 'gamma';say %h«$name»; # (c)say %h<<$name>>; # (c)
Read now
Unlock full access