use strict; use warning; print "\n Enter The file name :>"; chomp(my $filename1=); open(FILE,"<",$filename1) or die "\n...Cannot find the file: $filename"; open (W, "> Result.txt"); my @line; while () { push (@line, $_); my $count++; } print W $line [0]; for ($i = 0; $i < $count; $i++) { @st = split (' ', $line [$i]); if (($st [4] eq /chr1/) && ($st [10] eq /chr1/)) { print W $line [$i]; } }