>>>>> "IB" == Ingo Blechschmidt <[EMAIL PROTECTED]> writes:

  IB> Hi,
  IB> quoting http://dev.perl.org/perl6/synopsis/S06.html:
  >> Pairs can be used as lvalues. The value of the pair is the
  >> recipient of the assignment:
  >> 
  >> (key => $var) = "value";
  >> 
  >> When binding pairs, names can be used to "match up" lvalues
          ^^^^^^^
  >> and rvalues:
  >> 
  >> (who => $name, why => $reason) := (why => $because, who => "me");

note the binding := which is not the same as =. binding is similar to
aliasing. in the above case it matches the names and assigns the new
values accordingly. i am not sure what happens if you have more pairs on
one side or the other (does it behave as hashes would and just overwrite
the common keys and assign new ones as needed?)

  IB> that's really convenient, but what will the following code do?
  IB>   my $x = (a => 42); # $x is a Pair.
  IB>   $x = 13;           # Is $x now the Pair (a => 13) or
  IB>                      #           the Int 13?

$x is 13 now as you assigned it. to assign the value of the pair as an
lvalue i think you would do:

        $x.value = 13 ;

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to