if (!open IN,"< genes.txt") {      # make sure we can read the file
  die "Couldn't open in file: $!";
}
@arr = <IN>;
chomp @arr;
close IN;


if (!open OUT, "> new.txt") {      # make sure we can write to the file
  die "Couldn't open out file: $!";
}

foreach $line (@arr){ # proccess the save file line by line
  @words = split /\t|:|\.\./,$line; # make sure to escape the "." characters,
  if ($words[1] =~ /3/){ #check for the right chromosome
    $new = join "\t",@words; # build a new string separated by tabs
    print OUT "$new\n";
  }
}

close OUT; # Try opening the file in Excel or Calc
