open IN, "output" or die "Can't open file\n"; while() { # do something with $_ } close IN;