my $infile = "xxx_capillary_SNPs.txt\n"; open IN, $infile or die "open infile failed\n"; while(){ ## do your reverse complement } close(IN);