in reply to Choosing %hash by scalar value
Use a hash of hashes
Update: showed how to print key-value pair, at ysth's suggestion.my %attributes = ( computerAttributes => { cn => 'Common Name (eg. John Doe)', distinguishedName => 'Computer distinguishedname (dn) represen +ting object location in LDAP-directory', lastLogOff => 'Last time LDAP-directory received logoff + message from system' }, userAttributes => { cn => 'Common Name (eg. laptop1)', sn => 'Surename', displayName => 'First and lastname', title => '' } ) for my $key (keys %{$attributes{$choice}}) { print "Key: $key\tValue: $attributes{$choice}->{$key}\n"; }
|
|---|