Perl6 RFC Librarian wrote:
> The first component of a pair would be called its C<key>, and the second, it's
> C<value>. It is proposed to either extend the semantics of C<keys> and
> C<values> to allow them to operate of pair references, or else introduce
> two new built-ins -- C<key> and C<value> -- to access the components of a pair.

> =head2 Pairs and arrays
> 
> When a pair reference is assigned (in)to an array, it remains a single scalar
> (referential) value. So:
> 
>         @array = ( a=>1, b=>2, 'c', 3 );
> 
> assigns four elements (not six) to @array.

How do we get keys and values out?

  print $array{a}; # 1 
  print $array{c}; # undef? 3?

  print $array[0]; # 1? a? a=>1?
  print $array[2]; # c

  print join ',', keys @array; # a,b? a,b,c?
  print join ',', values @array; # 1,2,c,3? 1,2,3?

Or are hash operations syntax errors on @array?

  print value $array[0]; # 1
  print join ',', map {key} @array; # a,b? a,b,,?

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King

Reply via email to