in reply to Regexp for word with underscore in the middle

try (from your command line):
    perldoc perlretut

Your question doesn't tell us enough; the code helps, now that you've posted it but examples of your data would be very helpful too.

updated after OP posted code