This makes Perry's behavior very difficult to understand. After doing poorly in Iowa, he appeared to consider dropping out. He decided to stay in the race, but now it seems that he only was staying in for New Hampshire, which he must have known would have been a very weak state for him. Now it seems like he's just been wasting time and effort since Iowa. If he were endorsing Romney I might suppose he had some hope of an appointment or other benefit, but it's difficult to imagine what personal benefit endorsing Gingrich might offer him.
Issues of timing aside, dropping out of the race certainly seems to be the right thing for Perry to do. He does have a state to govern, and he's acting as a spoiler for other non-Romney candidates.