B
Ben Tisdall
Hi, hope I'm asking this in the correct place (I'm at the "'Learning
Perl' was a breeze" but "'Programming Perl' is frequently making my head
hurt'"stage...)
Anyhoo, I need to store info about which hosts users are logged into &
since they might be logged into more than one I'm using a hash of arrays.
Getting data in & pulling it out based on each key is no problem, but
what if I want to get a list of all machines currently logged into? I
know I can iterate over the hash using 'keys' & build a simple array of
all the hosts like this:
foreach (keys%userlist) {
push(@all,@{$userlist{$_}});
}
But it seems to me that this is unnecessarily expensive & I should be
able to use 'values' to get at the list.
I understand that values%userlist isn't right, but what is?
TIA.
Perl' was a breeze" but "'Programming Perl' is frequently making my head
hurt'"stage...)
Anyhoo, I need to store info about which hosts users are logged into &
since they might be logged into more than one I'm using a hash of arrays.
Getting data in & pulling it out based on each key is no problem, but
what if I want to get a list of all machines currently logged into? I
know I can iterate over the hash using 'keys' & build a simple array of
all the hosts like this:
foreach (keys%userlist) {
push(@all,@{$userlist{$_}});
}
But it seems to me that this is unnecessarily expensive & I should be
able to use 'values' to get at the list.
I understand that values%userlist isn't right, but what is?
TIA.