K
Krishna Chaitanya
Hi everybody,
I've read in Perl books that when used as lvalues, typeglobs are
"equivalent" to references...something like this is constantly quoted
as an example of selective aliasing:
*b = \$a; # aliases $b to $a but leaves @b,%b,etc untouched
Also, I've read about the *foo{THING} notation...accessing $a as:
print ${*a{SCALAR}}; # prints the value of $a
But what is this following code I see in some places:
print ${*a}; # ALSO prints the value of $a
I am confused.....how is ${*a} equivalent to ${*a{SCALAR}} ? If these
2 are equivalent, why follow the *foo{THING} notation at all...? Seems
like the '{THING}' part is quite useless here? Am I wrong, or am I
missing anything subtle/obvious here?
Pls. enlighten.....thanks a lot.
-Chaitanya
I've read in Perl books that when used as lvalues, typeglobs are
"equivalent" to references...something like this is constantly quoted
as an example of selective aliasing:
*b = \$a; # aliases $b to $a but leaves @b,%b,etc untouched
Also, I've read about the *foo{THING} notation...accessing $a as:
print ${*a{SCALAR}}; # prints the value of $a
But what is this following code I see in some places:
print ${*a}; # ALSO prints the value of $a
I am confused.....how is ${*a} equivalent to ${*a{SCALAR}} ? If these
2 are equivalent, why follow the *foo{THING} notation at all...? Seems
like the '{THING}' part is quite useless here? Am I wrong, or am I
missing anything subtle/obvious here?
Pls. enlighten.....thanks a lot.
-Chaitanya