|go ahead... be a heretic|
I haven't done much (ok any) Perl programming for a while (several years), and just come back to it recently.
I used to wake up thinking of Perl code snippets, and now it is back again.
Sometimes I could use this to good effect, by thinking about a particular programming problem as I fell asleep. Usually, when I woke up, the corrected code would have been stored away for retrieval, as though the little elves from "The Cobbler and the Elves" had been in there overnight and fixed the code.
Mostly though the as I fell asleep didn't happen until very late (early) or I would wake up in the middle of the night with a Eureka! moment.
This seems related to the ability (also just regained) to think in Perl. As with other "spoken" languages (e.g. Spanish) which I know a bit, I find myself thinking in Perl. Sometimes this is conscious, but more interestingly is when the Perl (or Spanish) way of expressing the concept pops into the head, and this is usually when the concept is best represented in that language.
So, I write this having been awoken by the little elves telling me that they have come up with a great idea for some obfuscated Perl code that they just had to tell me about !
I'd be interested to hear other monks' thoughts on this and whether they program in their sleep.
Update: This is the obfuscated Perl mentioned above.