in reply to One out of three ain't bad

"Intuitive" is subjective... to those who grok perl, your "more elegant" solution should make perfect sense, even if it's not the ultimate reality solution. If it satisfies all test cases (3! of them) then it works... if it's also readable, then let it be. Don't sweat the irrelevant.