Peter Scott wrote:
Don't use the term "symlink", however tempting, or you'll confuse
yourself and others about real symlinks.  Yes, it's not an array in the
hash; it's a scalar containing a *reference* to an array, and there may or
may not be other references to that array elsewhere in the program
depending on how the reference was constructed (with the anonymous
arrayref constructor or with the reference to a named array).


Even anonymous arrays can be accessed from more than one place.
#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;

# create an hash
my %a = ();

# populate it
$a{name} = 'a';
$a{array_ref}[0] = 'a';

# copy the hash
my %b = %a;

# display them
print '%a = ', Dumper \%a;
print '%b = ', Dumper \%b;

# change the copy
$b{name} = 'b';
$b{array_ref}[0] = 'b';

# display them
print '%a = ', Dumper \%a;
print '%b = ', Dumper \%b;

__END__


--
Just my 0.00000002 million dollars worth,
 Shawn

"For the things we have to learn before we can do them, we learn by doing them."
 Aristotle

"If you think Terrans are comprehensible, you don't understand them."
 Great Fang Talphon

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to