in reply to var comparison
Your question is "simple" but also complex.
My question to your question is: why?
Shorter code doesn't mean more efficient code.
Your first version is very clear and it will run quickly.
String compare is a very performant operation.
I guess that there is something about this question that you haven't told us about?
The first version will normally execute faster and it is more clear. What is the problem?
In Section
Seekers of Perl Wisdom