Your terminlogy is confusing. $a->{apple} has a value; it doesn't point to one.

my $b = $a->{apple};

would be equivalent to you snippet, except it won't convert the value to a string.
If $a->{apple} is a string, it will copy the string.
If $a->{apple} is a number, it will copy the number.
If $a->{apple} is a reference, it will copy the reference.
If $a->{apple} is undefined, $b will be undefined.

Similarly, I've seen many people do
my_func("$var1", "$var2", "$var3");
instead of
my_func($var1, $var2, $var3);
for no reason.

Concatenating with empty strings ("".$var) or quoting variables ("$var") is only needed to force stringification, and stringifying a variable is practically never needed. Functions that require a string (such as print, eval EXPR and the LHS of the regexp match operator) will stringify variables as needed, automatically.


In reply to Re: Getting the value of a pointer by ikegami
in thread Getting the value of a pointer by Washizu

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.