There is no such thing as perfect length, I think.
For a challenging action-heavy game I think around 12-14 hours is long enough. ie.: Games played on HARD the first time like: God of War 2, Uncharted (on Crushing), Devil May Cry 4, Ninja Gaiden Black. Notice I said "challenging"and for your first playtrough.
Action-Adventure (with a good part dedicated to story/cinematics/reading) could take a little big longer but in the same range of 12-15 hours on a challenging difficulty mode is more than enough.
Role-Playing Games because of the nature of the genre and level-up design and story-driven gameplay will always take more time to finish. Anything around 30 hours is generally considered pretty standard for an RPG length-wise.
All genres share one thing in common: their length is not really important as long as you enjoy the most of it and are left satisfied.
There are games that are "short" if all you care about is 'breezing through them' and watch the ending. These games could be masterpieces, but if you're not interested in digging further, you won't find out it has more to offer despite being "short". ie.: special things you can do to upgrade gameplay mechanics, master some areas of the game/bosses/encounters, find new and fun ways to solve a challenge, challenge yourself to be better by not going "the easy way" the game throws at you from the go. Some games have engaging stories that if you like them so much you'll play through it again many times no matter how short the game is. There are tons of examples and cases.