in reply to Lights out puzzle
Here's a solution written in perl, then some explanation on how it works.