in reply to comparing 2 lists
chomp @tableList; chomp @fileList; for $W (@tableList) { for $Q (@fileList) { if($Q =~ /$W/i) { print USED "$W\n"; } } }
This will use a simple regular expression to see if the table name $W matches anything in the query string $Q. The /i makes it case insensitive (so "two" will match "Two" or "TWO" for example.) The chomps are needed to strip off the newline character "\n" at the end of each line, else the match will fail unless the table name appears at the end of the query.
The matches will be printed to the output file, all others will be ignored.
I hope this helps - good luck!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: comparing 2 lists
by ikegami (Patriarch) on Jun 19, 2007 at 15:32 UTC |