in reply to Accessing Multilevel Hash Values

The quickest way would be to have another hash, with a name to socket name lookup... i.e.
$socket = 'socketa'; $connections{$socket} = {}; $connections{$socket}{name} = 'Bob'; $sockets{Bob} = $socket; #to access it $connections{$sockets{Bob}};
Of course... if you are only going to be accessing sockets by the "name", then you should consider using that as the key and storing the socket key somewhere else. But that is if name will be the only way you key in.

The other way is to write a for loop to iterate through the hash and find it

my $socket; my $name = 'Bob'; for my $key (keys %connections) { if($connections{$key}{name} eq $name) { $socket = $_; last; } } print "$socket is the socket for $name\n";
Also, when accessing a hash value you should prepend the hash with a $, not a %, as so:
$connections{socket}{username} = "Bob";
See Tye's References Quick Reference

                - Ant
                - Some of my best work - (1 2 3)