It's okay to have dreams.
Charlie is having nightmares about doing horrible things to people and is upset by them.
Charlie wants to avoid the emotional pain from the nightmares.
Charlie sees a therapist about the nightmares, who teaches him that dreams don't affect us.
Charlie refuses to sleep so that he doesn't have dreams or nightmares to worry about.
Charlie has the nightmares but can now deal with them properly.
Charlie falls asleep at random points in the day and his work suffers.