Multidimensional Hash Elements in Perl6
<>
is the same as {''}
in perl5 so should only be used for string keys. If you want to use the variable names go with :
%key{$barcode}{$position} = $sample_id
this should do the trick.
You can also use the double pointy brace option which does string interpolation.
%key<<$barcode>><<$position>> = $sample_id