in reply to Shorten this code

Not the shortest, but see for yourself.

#!/usr/bin/perl -w use strict; use Set::Scalar; chomp( my @l = <DATA> ); my %is_watched; @is_watched{ @l } = ( 1 ) x @l; my $prev = Set::Scalar->new(); { my $cur = Set::Scalar->new( grep $is_watched{ $_ }, split " ", `us +ers` ); my $t = localtime; print( map( "$t $_ has logged in\n", ( $cur - $prev )->members ), map( "$t $_ has logged out\n", ( $prev - $cur )->members ), ); $prev = $cur; sleep 2; redo; }

Makeshifts last the longest.