In what way.
They both probably had planned remarks and mispoke. Unless you believe Perry did not know what state he was in (I would not be surprised here if some think that is true). Do you also think President Obama believes those cities are Gulf ports?
I thought you were referring to the first instance, the Tonight Show, that is seen on the video linked below. I was not familiar with the second, in this video.
http://www.mediaite.com/online/tonight-show-not-the-first-time-president-obama-made-gulf-gaffe/
The first, with Leno, seemed to me to be just kind of throwing out thoughts, and I recall that some news source at the time inserted "and in" to read "and in places like Jacksonville, etc". They then retracted their correction, in order to prevent accusations of bias.
I think I assume that Obama knows enough about geography of the US to understand that he means, "All along the Gulf,
and in places like..." However, the second instance is much less clear, and I think an argument can be made that he was incorrectly stating that these cites were on the Gulf. It's more likely however, that he was just spouting memorized stuff and left out some of the important links, who knows?
I remember the big flap over "you didn't build that..." during the campaign, and that one was clearly a red herring by people who don't quite understand how to read between the lines and interpret fuzzy reference in extemporaneous speaking, combined of course with an Obama aversion.
I think the Perry and the Obama lapsus are superficially similar in certain respects--memorized talking points etc. But for Perry to visit a state, after much preparation and references to La., and hopefully his staff's prodding to mention certain key Louisiana hot button issues, then absentmindedly forget where he actually has landed...that is not impossible to imagine. But it is downright odd to then say that he had said "Louisiana", rather than "...what did I say? I meant Louisiana. Sorry. Haven't had my coffee yet.

"
It is also true that is is odd that Obama would leave such an obvious error hanging, but I generally think he has a lot on his mind and may often be speaking on autopilot--could be the same for Perry, sure, but his need for painkillers troubles me.
It's just too much of a stretch to seriously propose that Obama doesn't know which cities are not Gulf ports, and to then think that had Leno confronted him with,
"Gulf Ports, really?" and have him say in surprised disbelief,
"No, those cities are not Gulf Ports, what are you talking about?" I would think it would be reason for some to raise their eyebrows.
I suppose I give Obama the benefit of the doubt because of his obvious speaking skills, vocabulary and intelligence, while in the case of Perry I don't, largely because of his previous behavior of seeming not to care about facts, and his reliance on supernatural notions and biblical superstitious nonsense in his governing.
These cases are more of a question of a man's ability for coherent thinking than any question of intelligence or political ingenuity.