#!/usr/bin/perl # # Cross-reference two lists # Kacper Wysocki 2009-03-27 # Use as you like, and drop me a line. use strict; sub usage { print "$0 \n". " Cross-reference two lists for matches... like in CSI :-)\n". " Checks list2 for substrings of entries of list1. Ignores\n". " leading and trailing spaces.\n"; } usage and exit if not $ARGV[0]; open F1,"<$ARGV[0]" or die "could not open $ARGV[0]"; my @f1 = ; open F2,"<$ARGV[1]" or die "could not open $ARGV[1]"; while(){ chomp; s/^\s*(.*)\s*$/$1/; if(grep /$1/, @f1){ print "$1 = $_\n"; } }