The so called pencil cactus is actually a succulent euphorbia despite its name.
The pencil cactus prefers full sun for at least six hours a day and low humidity. Indoors, place it by a south or west-facing window. It will not thrive in low-light conditions. Let the soil dry out between waterings. During the growing season in the spring and summer, water your pencil cactus every two to three weeks. In the fall and winter, water only once a month.
The pencil cactus contains a thick latex sap that is toxic to both humans and animals. When the milky sap touches skin, it can cause redness, rashes, burning, or other skin irritations. Take care to not get the sap in your eyes because it can cause irritation and even blindness.