my %lookup = ( 'coffee' => 'non alky', 'beer' => 'alky', 'whisky' => 'proper alky', ); $drink = exists $lookup{$punter} ? $lookup{$punter} : 'unknown'; # or another option: # $drink = $lookup{$punter} || 'unknown';