Practical hint: you almost never need to use "eof" in Perl, because the input operators typically return "undef" when they run out of data, or if there was an error.