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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |