Stop asking "is $var a reference to $object" - since nearly everything is a reference, it doesn't make too much sense.

Instead, you could ask questions like "if I change $var1, does $var2 change too?"

Those questions are easy to answer - you can just try them out.

You can also think of a variable being a name for a container, and that container holds a value. Assignment changes the value, binding the container.

Does that copy the object referred to by $qux

No. Assignment to a scalar never copies any object (just pointers, internally). Only if you assign to an array or hash variable (ie one beginning with @ or %), a shallow copy is made.

my $xyz = 'hi'; my $xyz_ref = $xyz; # not a ref!

copies $xyz as expected. Correct?

No, just copies a reference to the string 'hi'. But since strings are immutable, you won't see any diference between two references to the same string, and two reference to copies of the same string.

Perl 6 - links to (nearly) everything that is Perl 6.

In reply to Re^9: Reference in Perl 6 by moritz
in thread Reference in Perl 6 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.