A famous joke from Groucho Marx:
“One morning I shot an elephant in my pajamas. How he got into my pajamas I'll never know.”
Does anyone know why this is funny? It's all because of a misplaced modifier: "in my pajamas." What is in pajamas? Not the elephant! If you wanted to take all the humor out of it and make it grammatically correct, here's how it would go:
"One morning, when I was in my pajamas, I shot an elephant."