http://qs321.pair.com?node_id=1212285


in reply to Matching multiple substrings of a string to arrays and printing those that match

Your dis and apr arrays only have one element each in them, corresponding to the last line of each file. You should push into each array. For example, change:
@dis_dic = $f1_line;

to:

push @dis_dic, $f1_line;

Also, your use of index looks strange. Re-read the docs. You could use grep there. But, I think using hashes is better than arrays in this case.