Peter Eisengrein wrote:

> OK, I sort of get it. But what hash is it a reference to? If 
> you wanted to
> access or modify the hash directly where is it?

You can modify it through either reference. Maybe the following code will
help you. Other references are 'perldoc perldata', 'perldoc perldsc',
Learning Perl, etc.

#---

my $hashref1 = { foo => 'bar' };

my $hashref2 = $hashref1;

# Only the reference is copied
print $hashref1->{foo}; # prints "bar"
print $hashref2->{foo}; # prints "bar"

# You can use either reference to modify the hash
$hashref2->{foo} = 'baz';

print $hashref1->{foo}; # prints "baz"
print $hashref2->{foo}; # prints "baz"

my %newhash = %$hashref1; #dereferenced, therefore values are copied

$hashref1->{foo} = 'qux';

print $hashref1->{foo}; # prints "qux"
print $hashref2->{foo}; # prints "qux"
print $newhash{foo}; # still prints "baz"

#---

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to