Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!brunix!jsb From: jsb@cs.brown.edu (John Bazik) Newsgroups: comp.lang.perl Subject: funky filehandle Message-ID: <45087@brunix.UUCP> Date: 16 Jul 90 17:48:29 GMT Sender: news@brunix.UUCP Reply-To: jsb@cs.brown.edu (John Bazik) Organization: Brown University Department of Computer Science Lines: 47 Here's a funny thing. I have a short script and a package it utilizes: script... #!/cs/bin/perl do 'tfio.pl' || die "tfio.pl: ($@)"; if (&f_open(*F, '/tmp/xxx')) { ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = stat(F); print "stat uid $uid gid $gid size $size\n"; print "/tmp/xxx is okay\n"; print "but eof\n" if eof(F); } else { print "/tmp/xxx nogood\n"; } while () { print "<$_>\n"; } package... package tfio; sub main'f_open { local(*F,$file) = @_; if (open(F, $file)) { return 1; } else { print "cannot open $file\n"; } return 0; } 1; Now, this works perfectly. But if I comment out the while loop, the stat fails to return anything and the eof(F) is true (though the file contains two lines). Why does the file have to be read to stat? I'm relatively new to perl, so please help me out if I'm totally off base. John Bazik jsb@cs.brown.edu