English Grammar: Dangling Modifiers
Dangling modifiers, or misplaced modifiers, are words, phrases or clauses where it is unclear which element of the sentence they are modifying, because they could either be modifying the subject or object.
Having trouble sleeping, the TV helps me get through the night.
Having trouble sleeping is a dangling modifier as it appears to modify the subject, TV, though clearly the person means that they have trouble sleeping. This could easily be improved by using as I have trouble sleeping.