in reply to Help wanted .. cant get my head around array of hash
Please put code here inside <code>...</code> tags, that way it's easier to read for us.
push (@{$ttys{$user}}, $tty );
There is a hash called %ttys. This statement access the item of this hash with the key $user, dereferences it as an array (that's the @{ ... } part) and pushes the variable $tty onto this array.
You need to do such a thing if you have multiple key/value pairs with the same key.
A user can have allocated several terminals (ttys), so for a mapping from user to terminal you need to account for the possibility of having more than one terminal per user.
See also perlreftut and perldsc.
|
|---|