You expect people to determine from deep understanding of the code why your program doesn't work.
I view programming the other way around ..... it doesn't work? What is the return value of execute()? What does DBI::errstr() return? If you run the program in the debugger, what happens in the first ( and only successful ) execute()? Is there a second execute() attempted but it fails? Or does the loop terminate after the first execute?
As Occam said: Entia non sunt multiplicanda praeter necessitatem.