You probably want a call to sleep in the connection attempt loop, or perhaps some extended diagnostics. No point in just trying 4 times in a row without waiting for the connection problem to get resolved, of doing some connection diagnositcs.
You might consider:
DBI->connect(....) || fatal(DBI->errstr)