Not sure exactly which parts are giving you trouble, but note that "joe blow" is NOT how the uid, gid and gecos are being accessed. "joe blow" is simply the value of the key gecos in the subhash. The subhash is, itself, the value of the key jblow in the hash called $hash1.
Part of your confusion may be that you're mixing hashes with hash references; the topmost hash, $hash1, is a normal hash, since you're doing the equivalent of:
my %hash1 = ( ); # %hash1 is a normal hash (note the '%' prefix) $hash1{$name} -> {'uid'} = $uid; $hash1{$name} -> {'gid'} = $gid; $hash1{$name} -> {'gecos'} = $gecos;
rather than:
my $hash1 = { }; # $hash1 is a hash reference (note the '$' prefi +x) $hash1 -> {$name} -> {'uid'} = $uid; $hash1 -> {$name} -> {'gid'} = $gid; $hash1 -> {$name} -> {'gecos'} = $gecos;
But then the key 'jblow' has as its value a hash reference, where the -> notation is used.
In the case of:
$VAR1 = { 'jblow' => { '2195' => { 'gecos' => 'Joe Blow,,,', 'gid' => '20' } } };
you simply have another level deep, since the key '2195' has as its value a reference to another hash (that of { 'gecos' => 'Joe Blow,,,', 'gid' => '20' }) instead of a simple scalar.
You could even combine the two, and have:
$VAR1 = { 'jblow' => { 'uid' => '2195', 'gecos' => 'Joe Blow,,,', 'gid' => '20', '2195' => { 'gecos' => 'Joe Blow,,,', 'gid' => '20' } } };
In reply to Re: Comparing HoH and HoHoH
by liverpole
in thread Comparing HoH and HoHoH
by mikejones
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |