This is a common anal complaint that is usually due to an anal problem or to poor anal hygiene. A doctor will want to know what the discharge looks like (i.e. is it faeculent, watery, mucus or pus), whether there are any other symptoms and how long it has been going on. If there are symptoms of bleeding and prolapse (something coming down and out of the anus) then it may well be due to piles. There may be associated pruritus ani (itching) due to the discharge causing damage to the perianal skin.
Possible causes of a discharge include poor anal hygiene, piles, anal fissure, perianal abscess, fistula-in-ano, anal warts, and anal cancer. Also disease in the rectum may also cause this symptom, such as solitary rectal ulcer, an adenoma (benign growth) and Crohn's disease.
When seen by a doctor he will want to examine the perianal skin and examine the anus with a gloved finger. He may also take a sample of the lining of the rectum through a telescope in order for the laboratory to determine whether there is any inflammation of the rectum.
The treatment obviously depends on the cause of the condition.
The doctors will arrange for further tests and investigations if appropriate.