First, let me place my answer in the context of American academia. I'm sure that in some other parts of the world social conventions are different.
Contemporary American academia is one of the more formally progressive and tolerant subsets of western society. There are American schools which recognize a student's right not to have any gender! Although this is an extreme point, academic culture places a premium on toleration of personal differences, to the extent that most hiring committees are instructed not to take such "irrelevant things" as personal appearance into account.
But do they? I think all human beings do, in some ways. I do believe that people who are more physically attractive make more attractive job candidates, all other things being equal (and there are lots of studies to back this up). Recently for health reasons I lost a substantial amount of weight, and I think that my relations with undergraduate students are noticeably better, e.g. resulting in higher evaluations. Of course this probably has at least as much to do with the way I (nonverbally) communicate that I perceive myself: being more comfortable in your own skin shows.
As a result, if long hair feels natural and good to you, then I would recommend that you keep it. Like Samson, it may somehow be a source of strength for you. I was going to say that even the fact that you're asking about it seems slightly strange, but then I remembered that as a graduate student I would shave my goatee every fall (when I was teaching) and let it grow every spring (when I wasn't). I have now had a goatee continuously since getting a PhD in 2003! I also used to dress more nicely for class than I otherwise would. While I still think that one should not wear clothing which is especially ratty in any professional context, I have long since learned that nobody cares whether I wear sneakers or a jacket or anything like that.
The other thing is that it is not 1964 anymore: the men who were long-haired youths in the 1970s are now some of the senior people around, and many are still proudly growing long what remains of their hair. Both of the men who have been department heads in my time at my present job grow their hair longer than what conservative mores would recommend, and the current chair has hair halfway down his back. It is really no big deal.
Let me say finally that the odd faculty member who mutters something sour about your hair probably had other reasons not to like you. And if not, do you really want colleagues who are so superficial and intolerant? Times are tough, but I think one needs to make feeling comfortable in one's own skin a high priority.