As indicated by the first reply, a single regex consisting of 100 values as alternates is not such a big load, really. And you don't even need a special module to do it this way:
my $value_regex = join( '|', values %msgDefn ); # actually, use anony +monk's version below... while ( <FILEHANDLE> ) { print if ( /$value_regex/ ); }
That assumes that the values in your hash are all "safe", in the sense that they don't contain any regex magic characters, like brackets, *, ?, +, period, slash, backslash, and so on.

If the values might contain things of that sort, you could handle it like this (but YMMV, depending on what's really in your data):

my $value_regex = join( '|', map { '\Q'.$_.'\E' } values %msgDefn );
Now, if you ultimately need to know which hash key contains the value that actually matched a given line from the file, then you'd really want to build a reverse hash, as suggested in the 2nd reply.

Update (forgot to mention): Naturally, lots of other caveats apply, such as false-alarm matches on substrings (e.g. a value like "table", treated as above or as in the OP, would match on a line that contains "stable" or "tablet", which might not be what you want.


In reply to Re: Parse a huge file and match the lines against a hash entry by graff
in thread Parse a huge file and match the lines against a hash entry by snra_perl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.