Associative array/Creation: Difference between revisions

m (fixed copy/paste python tag)
Line 1,062:
<lang perl6>my %h1 = key1 => 'val1', 'key-2' => 2, three => -238.83, 4 => 'val3';
my %h2 = 'key1', 'val1', 'key-2', 2, 'three', -238.83, 4, 'val3';</lang>
 
Creating a hash from two lists using a metaoperator.
 
<lang perl6>my @a = 1..5;
my @b = 'a'..'e';
my %h = @a Z=> @b;</lang>
 
Hash elements and hash slices now use the same sigil as the whole hash. This is construed as a feature. Curly braces no longer auto-quote, but Perl 6's <code>qw</code> (shortcut <code>&lt; ... &gt;</code>) now auto-subscripts.
Anonymous user