in reply to Re^7: Reference in Perl 6
in thread Reference in Perl 6
Ok, so,
sub foo($x, $y) { say $x ~ $y }; my $foo_ref = &foo;
assigns a reference to $foo_ref (makes sense (since I don't see why I'd want to copy a function), and
my @bar = <a b c>; my $bar_ref = @bar; # Assigns a reference. Ok. my $bar_ref2 := @bar # Same as above? XXX my @bar_copy = @bar; # Makes a copy of @bar. As expected.
and
my $qux = SomeClass.new; # $qux is a reference to an object my $qux_ref = $qux; # makes a copy of the reference (?)
Does that copy the object referred to by $qux, or just the reference?
However,
my $xyz = 'hi'; my $xyz_ref = $xyz; # not a ref!
copies $xyz as expected. Correct?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Reference in Perl 6
by moritz (Cardinal) on Aug 23, 2010 at 12:10 UTC | |
by Anonymous Monk on Aug 23, 2010 at 18:19 UTC |