It's a factor, for sure. While I don't especially find long hair attractive on a guy, I like to see a guy with a short or buzz cut with a full head of hair. Nature decided that I'd have male pattern baldness, so I cut my hair every weekend with a pair of clippers with no guard. Bald guys with long hair look freaky to me, so my hair never gets longer than 1/4". I've tried shaving it. It's looks cool, but feels weird when I wear a hat or bicycle helmet.
I was hung up about it in my early 30s and went for a hair transplant consultation. After finding out it would be a fortune to do the procedure, I said "Screw it!" and figured that if people don't want to like me because of my hair, then they don't have to like me! I compensated for it by running harder and working out more at the gym. If you have a smokin' hot body, peoples' eyes focus on your bod, not your hair.
Now that I'm older, I'm indifferent about not having a pretty boy haircut. I'm so far past caring about vanity that it's all about being healthy and having fun.