use User; package Community; sub new { my $self = shift; $self = {}; my @tmp = (); $self -> { USERS } = \@tmp; return bless $self; } sub adduser { # add a User object to this container object my $self = shift; my $aref = $self -> { USER }; push @$aref, shift(); } sub retch { # destructive random fetch of User # from this container object my $self = shift; my $aref = $self -> { USER }; return splice( @$aref, rand() * $#$aref ); } 1;