After spending so many years working in hospitals, one would expect the doctor to have retired.
After spending so many years working in hospitals, one would expect the doctor to retire.
Q1) Do they both mean the same?
Q2) What is the subject of "spending". Is it "one" or is it "the doctor"? In other words, is this a case of "dangling modifier"?