in reply to Reference curiosity?

To elaborate on what borisz said -

Your second example does display the appropriate run-time error messages:

Global symbol "%hash" requires explicit package name at test-hashref.p +l line 6. Global symbol "%hash" requires explicit package name at test-hashref.p +l line 6. Global symbol "%hash" requires explicit package name at test-hashref.p +l line 6.
This is easily corrected by changing line 6 to:
print "$hash->{A} $hash->{B} $hash->{C}\n";
which prints
1 2 3
as expected.

     "For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken

Replies are listed 'Best First'.
Re^2: Reference curiosity?
by Anonymous Monk on Apr 23, 2006 at 19:07 UTC
    "This is easily corrected by changing line 6 to:
    print "$hash->{A} $hash->{B} $hash->{C}\n"; "
    I prefer:
    print "$$hash{A} $$hash{B} $$hash{C}\n";