develooper Front page | perl.perl6.language | Postings from May 2008

not a reference - What does this mean?

Thread Next
From:
John M. Dlugosz
Date:
May 4, 2008 16:13
Subject:
not a reference - What does this mean?
Message ID:
24433-15422@sneakemail.com
Perl 6 doesn't have references anymore, it has captures.  So, what does 
the following mean:

 @x = <foo bar>;
 $a = [1, 2, \@x];

I imagine that the 3rd element of the Array is itself an Array, and is 
the same object that is bound to @x.  But captures are lazy 
context-sensitive beasts, so I wonder if there is more poised to go on 
than I want or care about in this example.

  say $a[2] === @x;     #gives True
  @x[1] = "baz";
  say $a[2][1];  #gives baz

--John


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About