print "\nEnter your words (separated by spaces): >> "; chomp(my $line = ); my @words = split /\s+/, $line; for($i = 0; $i <= ($#words-1); $i++) { for($j = $i+1; $j <= $#words; $j++) { print "========================================\n"; print "\t", ucfirst(@words[$i]),"\t", ucfirst(@words[$j]),"\n"; print "========================================\n"; local $/=undef; print grep{!/(@words[$i,$j])/} =~ m!(.*?)!gs if /(@words[$i,$j])/; } } __DATA__ c:\data\cat.xml dog, cat, fish, bird c:\data\cow.xml dog, cat, fish, bird, cow, goat c:\data\snake.xml dog, cat, fish, bird, snake, orange