in reply to comparing 2 files

fgrep -i -w -f DBtest.txt databaseJoinDan.txt > tableUsed.txt

Perl code to do something like this (but without all the complex options of grep) could be as follows:

# find_strings.pl use strict; use warnings; my $patfile = shift; my @pats = do { local @ARGV = ( $patfile ); <> }; chomp @pats; my $pat = join '|', @pats; while (<>) { /\b($pat)\b/i and print; }

With the above code, invocation would be slightly different from the fgrep solution.

perl find_strings.pl DBtest.txt databaseJoinDan.txt
(for example).