File 1 Start Stop Name 234 388 abc 458 267 pqr ... ... 873 490 xyz #### File 2 Name abc dfr hyt hig wer pqr ... ... xyz #### Output file 234 388 abc 458 267 pqr #### #!/usr/bin/perl # Open info file, and read in all the name start and stops my $input_file = "/Users/myfolder/inputfile.txt"; die "Cannot open $input_file\n" unless (open(IN, $input_file)); my %name_and_Start_Stop; while (chomp($line = )) { my (@columns) = split /\s+/, $line; my $name = $columns[3]; my $Start = $columns[1]; my $Stop = $columns[2]; $name_and_Start{$name} = $Start; $name_and_Stop{$name} = $Stop; } close(IN); # Open the input file, and read each name die "name_list.txt" unless open(IN, "name_list.txt"); #Open output file and write the name start and stops die "output.txt" unless(open(OUT,"> output.txt")); while (chomp($symbol = )) { my $Start = $name_and_Start{$name}; my $Stop = $name_and_Stop{$name}; print OUT "$Start\ $Stop \ $name \n"; } close(OUT); close(IN);