"... if I were a girl"
A very simple way of viewing the whole mood thing is that fact-statements are indicative, and thought-statements are subjunctive.
In this sentence, assuming that the speaker is male, being a girl is not a fact and cannot be indicative. Being a girl is a thought-statement, so it should use a subjunctive verb.
This can be tested by inversion - removing the 'if' and inverting the verb and subject. "... were I a girl" still works, but "... was I a girl" doesn't.
This demands the question "Why did a Longman Grammar book use "...if I was a girl?" Well, grammar books can and do get things wrong, possibly deliberately to keep things simple at lower level. Another possibility is that they are jumping on the lazy-man's bandwagon of pretending the subjunctive doesn't exist anymore - a depressingly popular bandwagon.