#!/usr/bin/perl die "Usage: $0 WORDLIST-FILE-1 WORDLIST-FILE-2" if ($#ARGV != 1); open(W1, '<' . $ARGV[0]) || die; open(W2, '<' . $ARGV[1]) || die; while () { chop; $w1[$#w1 + 1] = $_; } close(W1); while () { chop; $w2[$#w2 + 1] = $_; } close(W2); foreach $a (@w1) { foreach $b (@w2) { print "$a$b\n"; print "$a $b\n"; } }