The key is not lust (think sexual thoughts of girls)... for me personally... sometimes I'd just avoid looking at women altogether.. to avoid any chance of lusting.
In the Bible, Paul spoke of himself having so much dicipline in this area that he said he had a gift and never got married because he could stand being single and not lust. Marriage in part was encouraged by Paul because of sexual immorality.
1 Corinthians 7:2
But since sexual immorality is occurring, each man should have sexual relations with his own wife, and each woman with her own husband.
So, there's people like Paul who don't need marriage to not lust... and then there's people like me... who probably should get married. My point is that there are differnt people with different kinds of ressistances. What you have to do is keep a check on your thoughts and use the common sense of just not looking or staring at girls if your lusting.
Proverbs 22:3
The prudent see danger and take refuge, but the simple keep going and pay the penalty.
^^^ If you see danger of lust... don't keep looking. Close your eyes. Look at another direction so you don't lust. Be prudent.
I also recommend that you read proverbs... the first 5 chapters advices you to some extent about women being to men. Also, proverbs by default is just a great advice book... been really liking what I've found there.