comparing two files for matching fields

I am newbie to unix and would please like some help to solve the task below
I have two files, file_a.text and file_b.text that I want to evaluate.
file_a.text

   1698.74       
1711.88 
      6576.25       
899.41       
3205.63       
4187.98       
697.35 
      1551.83     

file_b.text

         1698.73
1711.08 
      6576.25
899.31 
      3205.53
4187.68       
697.35 
      1551.73      

Task
I want to compare file_a.text to file_b.text and print out fields where the variables in file_a.text matched to the variables in file_b.text with an error window of 0.5.

thus if file a variables = X, i want to print fileds where file_b variables = X � 0.5
Thanks

sort -n file1.txt > file1
sort -n file2.txt > file2
awk 'FILENAME=="file1" {arr[NR]=$0; cnt++}
       FILENAME=="file2" {for (i=1; i<cnt && $0 < (arr +.5); i++)
                                      {
                                        if($0>= (arr -.5) && $0 < (arr + .5)
                                           {print "file2 line ", NR, $0}  
                                       } 
                                   } '


perl -e 'open F1,"< file_a.text"; open F2,"< file_b.text";
while (1) {
    $l1 = <F1>; $l2 = <F2>; last unless ($l1 || $l2);
    chomp ($l1, $l2);
    print "$l1\n" if ($l1-$l2 <= 0.5 && $l1-$l2 >= -0.5);
}
close (F1, F2)'

I get this error message when I run the code you gave below below. I am not sure why. Please any help?

awk: cmd. line:4:    if($0>= (arr -.5) && $0 < (arr + .5)

awk: cmd.     line:4:                                                                        
                                 ^ unexpected newline or end of string
sort -n file_a.txt > file1
sort -n file_b.txt > file2
awk 'FILENAME=="file1" {arr[NR]=$0; cnt++}
       FILENAME=="file2" {for (i=1; i<cnt && $0 < (arr +.5); i++)
                                      {
                                        if($0>= (arr -.5) && $0 < (arr + .5)
                                           {print "file2 line ", NR, $0}  
                                             } 
   } '