I had a left inguinal hernia surgery in 2010. I feel discomfort in perineum after ejaculating. What could be the reason?

Could be several. Painful ejaculation is not normal. This could be the result of a sexually transmitted infection, injury, an anatomical variant, or an abnormal process such as prostatitis or retrograde ejaculation. Urinary tract infections and spurious pain in the genitals are rare conditions in men with normal anatomy. This probably warrants std testing, urinalysis, and possibly referral to a urologist.