<?xml version="1.0" encoding="windows-1252"?>
<node id="852900" title="Perl 6, defining a hash with interpolated string" created="2010-08-04 11:44:58" updated="2010-08-04 11:44:58">
<type id="115">
perlquestion</type>
<author id="380140">
Mr_Micawber</author>
<data>
<field name="doctext">
&lt;p&gt;I've been experimenting with using interpolated strings
to define hashes.  I'm curious why the variation defining &lt;c&gt;%kv&lt;/c&gt; below works.  There's something about the colon, which I think is a pair constructor (?) and the square brackets that I'm not getting. 
&lt;/p&gt;


&lt;code&gt;
#!/usr/bin/perl6

use v6;

my ($hkey, $hval ) = &lt;somekey someval&gt;;

# simple form:
#  my %kv = $hkey, $hval;   # works

my %kv = :[$hkey],$hval;    # works

#  my %kv = :$hkey,$hval;   # error
#  my %kv = :{$hkey},$hval; # _block83 someval

say %kv; # somekey someval
&lt;/code&gt;</field>
</data>
</node>
