Trap 5 - a solution 

sub logged_on_users {
  my @a = sort
          map { $_->username }
          values %sessions;
}
sub logged_on_user_count {
  return scalar keys %sessions;
}