use strict; use warnings; my $infile1 = $ARGV[0]; my $infile2 = $ARGV[1]; my $outfile = $ARGV[2]; unless (open( INFILE1, $infile1)) { die "Cannot open $infile1\n"; } my @array; my @slice; my @array1; my @slice1; my $element; while() { chomp; my @array = split ('\t', $_); my @slice = @array[0,1,2]; } open (INFILE2, "<", $infile2) || die "cannot open $infile2"; open (OFILE, ">", $outfile) || die "cannot open $outfile"; my $i = 0; while () { chomp; my @array1 = split ('\t', $_); my @slice1 = @array1[1,2,3,4]; $slice1[0] = s/chr//g; for ($i=0; $i < $#slice1; $i++) { foreach my $element (@slice) { print OFILE $slice1[3] ."\n"; } else { print OFILE "NA\n"; } } } }