open(INPUT,"infile.txt"); binmode(INPUT); while() { ... } close(INPUT);