Combine all lines of a file with all lines of another file.

Dear all,
I would like to combine all lines of a file with all lines of another file:
The input are
file 1
A
B
C
D

file 2
A
B
C
D

The output is
final file
A_A
A_B
A_C
A_D
B_B
B_C
B_D
C_C
C_D
D_D

In the output file it was combined A_B but not B_A, because it is redundance for me and just one combination is enough. The same idea need to be applied for all lines.

NOTE: There are 39,278 lines in the file 1 and 39,278 lines in the file 2.The sequence of letters are equal in both files, such as in the example. I'm using OSX and the computer has 12 Gb of Ram.

How can I combine these lines?

Thanks in advance.

#!/usr/bin/ksh
typeset -i mPos=1
while read m1; do
  sed -n "${mPos},\$s/^/${m1}_/p" One_File
  mPos=${mPos}+1
done < One_File
open $fh,"<a";
my @arr = <$fh>;
close $fh;
open $fh,"<b";
my @brr = <$fh>;
close $fh;
@arr=map {chomp;$_}@arr;
@brr=map {chomp;$_}@brr;
foreach my $a(@arr){
  foreach my $b(@brr){
    my @tmp = ($a,$b);
    my $str = join "_", sort @tmp;
    if(not exists($hash{$str})){
     print $str,"\n";
     $hash{$str}=1;
    }
  }
}

Thanks. It works as I wanted.