Dear fellow monks,

being a novice I try to improve my skills by solving the following problem with perl. It is said to be invented by Albert Einstein who believed only 2 percent of the world population could solve it. He had no idea of perl or the monastery, of course ;^)


So here's the task:

1. There are five houses with different colours.

2. In each of the houses there lives a member of a different nation.

3. Each one of these people likes a special drink and a special cigarrette best and has a special pet.

4. None of the 5 persons likes the same drink or cigarrete best or has the same pet as one of his neighbours.


To whom belongs the fish?


The British lives in the red house.
The Swedish has a dog.
The Danish likes tea.
The green house is standing left of the white house.
The owner of the green house drinks coffee.
The person smoking Pall Mall, has a bird.
The man living in the middle house, drinks milk.
The owner of the yellow house smokes Dunhill.
The Norwegian lives in the first house.
The Marlboro-smoker's neighbour has a cat.
The man with the horse lives next to the Dunhill-smoker.
The Winfiels-smoker drinks beer.
The Norwegian lives beneath the blue house.
The German smokes Rothmanns.
The Marlboro-smoker has a neighbour who drinks water.


I think of creating an array of five hashes (with the six keys: house_number, colour, drink, cigarette, pet, and nation). One could then fill out the known attributes and try to move the hashes around the array until each but one field is filled.

So far the thoughts of a poor brain ... Can anyone please tell me if this might be the right start and how to get on?

Having solved the problem by hand, there is another question: How comes, that the German doesn't drink beer? ;^) Thanks for your help!