The novel's first-person protagonist, an unnamed vagrant with intellectual leanings, probably in his late twenties, wanders the streets of Norway's capital, Kristiania (Oslo), in pursuit of nourishment. Over four episodes he meets a number of more or less mysterious persons, the most notable being Ylajali, a young woman with whom he engages in a mild degree of physical intimacy.
He exhibits a self-created code of chivalry, giving money and clothes to needy children and vagrants, not eating food given to him, and turning himself in for stealing. Essentially self-destructive, he thus falls into traps of his own making, and with a lack of food, warmth and basic comfort, his body turns slowly to ruin. Overwhelmed by hunger, he scrounges for meals, at one point nearly eating his own (rather precious) pencil. His social, physical and mental states are in constant decline. However, he has no antagonistic feelings towards 'society' as such, rather he blames his fate on 'God' or a divine world order. He vows not to succumb to this order and remains 'a foreigner in life', haunted by 'nervousness, by irrational details'.
He experiences a major artistic and financial triumph when he sells a text to a newspaper, but despite this he finds writing increasingly difficult. At one point in the story, he asks to spend a night in a prison cell, posing as a well-to-do journalist who has lost the keys to his apartment. In the morning he cannot bring himself to reveal his poverty or even partake in the free breakfast provided to the homeless. Finally, as the book comes to close, when his existence is at an absolute ebb, he signs on to the crew of a ship leaving the city.

Question: What important item did the man almost eat out of hunger?
Answer: His pencil. 
Alternative answer: His own pencil.