sub get_random_room { my $self = shift; my $random_room = ''; if ( defined $self->{exits} ) { $random_room = $self->{exits}{ ( keys %{$self->{exits}} ) [ rand keys %{$self->{exits}} ] } unless ('exit'); return $random_room; } }