in reply to efficient text processing

If you read a file like this: my @array = <HANDLE> it will read the whole file into memory first, and then starts working with that. If the file is huge, much memory will be consumed.

Instead you should write it this way:

while (my $line = <HANDLE>) { # do something with $line here }

Also if each array item is counted only once, you can rewrite your hole last loop this way:

my $regex = join '|', map quotemeta, keys %g_wvr_list; my $waived = 0; for (@tmpArr){ $waived++ if m/$regex/; }