Unless you're in IT or show business, men with long hair are indeed unprofessional in appearance.
It doesn't prevent you from doing a good job but all things equal they will go for the short hair dude.
It doesn't make sense but that's how it works.
Fortunately for you, hair can be cut. A lot of employers apply the same kind of prejudice to blacks, portoricans or women.