Item contexts
Use "$" or ".item" to force the item (scalar) form of an object
my @a = 1,2,3; my @b = 10,20,30; my @one = @a, @b; # 1,2,3,10,20,30 say @one.elems; # 6 my @two = $(@a), $(@b) # [1,2,3], [10,20,30] say @two.elems; # 2
Perl 6 | Perl 6 Lists, Arrays, and Hashes vivified | #17 |
Use "$" or ".item" to force the item (scalar) form of an object
my @a = 1,2,3; my @b = 10,20,30; my @one = @a, @b; # 1,2,3,10,20,30 say @one.elems; # 6 my @two = $(@a), $(@b) # [1,2,3], [10,20,30] say @two.elems; # 2
Copyright © 2011 http://www.pmichaud.com/2011/pres/ |