Combined from primary sources listed below.
See primary docmentation in context for method item.
method item(Mu \item:) is raw
Forces the invocant to be evaluated in item context and returns the value of it.
say [1,2,3].item.raku; # OUTPUT: «$[1, 2, 3]»
say %( apple => 10 ).item.raku; # OUTPUT: «${:apple(10)}»
say "abc".item.raku; # OUTPUT: «"abc"»
See primary docmentation in context for sub item.
multi item(\x)
multi item(|c)
multi item(Mu $a)
Forces given object to be evaluated in item context and returns the value of it.
say item([1,2,3]).raku; # OUTPUT: «$[1, 2, 3]»
say item( %( apple => 10 ) ).raku; # OUTPUT: «${:apple(10)}»
say item("abc").raku; # OUTPUT: «"abc"»
You can also use $ as item contextualizer.
say $[1,2,3].raku; # OUTPUT: «$[1, 2, 3]»
say $("abc").raku; # OUTPUT: «"abc"»