chinamox has asked for the wisdom of the Perl Monks concerning the following question:
Greetings again all of you good monks.
I am attempting to set up a very simple Perl app using the 'who' command in Unix.
Basically I want to set up a simple hash using somthing like:
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.
The read out would look something like:
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.
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).
I am attempting to set up a very simple Perl app using the 'who' command in Unix.
Basically I want to set up a simple hash using somthing like:
my %who=('who -q');
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.
The read out would look something like:
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...
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.
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).
2006-10-02 Retitled by planetscape, as per Monastery guidelines ( keep:0 edit:7 reap:0 )
Original title: 'Perl in Unix question'
Back to
Seekers of Perl Wisdom