# At start of program, set up the starting location and description of each object my $Objects = ( light => { location=>BEDROOM, description=>'The chair in front of your desk has your uniform slung over it', }, keycard => { location=>BEDROOM, description=>'Your keycard sits on the desk', } ... etcetera ... }; sub display_items_in_location { my $loc_to_display = shift; for my $item (keys %Objects) { if ($Objects{$item}{location} == $loc_to_display) { print $Objects{$item}{location}; } } }