in reply to Shorten this code
#!/usr/bin/perl -w0777 @users{split /\s+/, <DATA>}=(); while(sleep 2) { for my $n (keys %users) { $_ = `users`; $state = ''; $users{$n} = 1, $state = 'in' if !$users{$n} && /\b$n\b/; $users{$n} = 0, $state = 'out' if $users{$n} && !/\b$n\b/; print localtime() . " $n has logged $state\n" if $state; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Shorten this code
by tilly (Archbishop) on Aug 13, 2004 at 01:37 UTC | |
by hostyle (Scribe) on Aug 13, 2004 at 17:44 UTC | |
by BrowserUk (Patriarch) on Aug 13, 2004 at 19:06 UTC |