As an alternative to parsing the output of the external command you might consider using Sys::Utmp:
use Sys::Utmp; + my $utmp = Sys::Utmp->new(); + my %users; + while ( my $utent = $utmp->getutent() ) { if ( $utent->user_process ) { $users{$utent->ut_user}++; } } + $utmp->endutent; + foreach my $user (keys %users) { printf "%s is logged in %d times\n", $user, $users{$user}; }
/J\
In reply to Re: parsing output of UNIX `who` command
by gellyfish
in thread parsing output of UNIX `who` command
by chinamox
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |