perlquestion
chinamox
Greetings again all of you good monks.
<br><br>
I am attempting to set up a very simple Perl app using the 'who' command in Unix.
<br><br>
Basically I want to set up a simple hash using somthing like:
<br><br> <code>
my %who=('who -q');
</code>
<br><br>
I would then like then like to set each of the returned usernames as keys for the hash and have the values in the hash show the number of sessions that a user is logged in.
<br><br>
The read out would look something like:
<br><br>
<code>
Beckysue is logged in 1 time.
Billybob is logged in 3 times.
BubbaJoe is logged in 2 times.
Saranne is logged in 1 time.
<br><br>
ect...</code>
<br><br>
I have a strong urge to try the functions keys(%hash) and values(%hash) but I think I also might be haveing problems passing data from that 'who' command.
<br><br>
<br><br>
Thank you in advanced, I am trying to learn Perl from my home in Beijing with very limited help in meatspace. I have been ramming my head into the desks for the last few hours and the this is upseting the little old lady nextdoor. If anyone can offer a hint, you would be my hero for the day (or night). <p><small>2006-10-02 [id://340870|Retitled] by [planetscape], as per Monastery [id://341118|guidelines] <readmore title="view votes">( keep:0 edit:7 reap:0 )</readmore>
<br />Original title: 'Perl in Unix question'</small></p>