Question:
Hi. I know one must wash after scratching scalp. Is this just before prayer. If one scratches behind neck/ear and cannot wash before buying food,is that ok?
Answer:
While it is preferred to wash them right after scratching your scalp, you don't have to. You only have to have to have washed them before you make a bracha daven etc. By the way you only have to wash them once and even if it is not with a cup, (although according to some opinions it is better that way).
As a side point yoו do not have to wash your hands when scratching behind your ears or your neck, but only if you touch a place on your body that is usually covered.
Best wishes
Sources:
O:CH 4-18, M:B 4-39