#!/opt/perl/bin/perl
use Storable;
my $sd = retrieve 'room_data.stor';

my %rooms;
for my $conf (keys %$sd) {
   for my $room (keys %{$sd->{$conf}}) {
      my $data = $sd->{$conf}->{$room};
      $rooms{$room} = $data;
   }
}

my $total;
for my $r (sort { $a->[3] <=> $b->[3] } grep { $_->[3] != 0 } values %rooms) {
   next unless $r->[3] >= 4;
   $total += $r->[3];
   printf "%3d: %-50s | %s\n", $r->[3], $r->[1], $r->[2];
}
print "total users: $total\n";