input file1: it contains lower limit and upper limit 

```
1:     3     5  
2:    4     7  
3:     8     10  
4:    5     10  
5:    10    15  
6:    10    20  
7:     15    30  
8:    30    40  

```

input file 2: it contains certain values 

```
a    3  
b    4  
c    6  
d    7  

```

file 3:it also contains some values 

```
a    9  
b    12  
c    36  
d    23  

```

output:

```
1    a b      file2  
2    b c d    file2  
3      
4    c d      file2  
5    b        file3  
6    b        file3  
7    d        file3    
8    c d      file3    

```

I have three file. file1 contains the range and file2 or file3 contains certain values. now we have to check for their interval id from file 1 and print the output for a hit i.e.,
if a value belongs to any interval then it must print the interval id , value id and the file it come from .

```
#!/bin/usr/perl -w  
use strict ;  
open (R1,"$file1.txt")|| die;  
open (R2,"$file2.txt")|| die;  
open (R3,"$file3.txt")|| die;   

 while (($lin1=<R1>) && ($line=<R2>) && ($line3= <R3>)){
  my $i;

```

stuck up here .. how to check weather a particular value of file 2 and file3 belongs to which and how many interval in the file1