in reply to How do i get EOF to work?

#!/usr/bin/perl use strict; my $file = "/etc/passwd"; open(PASSWD, $file) or die "Couldn't open $file: $!\n"; unless(eof(PASSWD)) { print $_; }
Hope this helps.

Replies are listed 'Best First'.
Re: Answer: How do i get EOF to work?
by zentara (Cardinal) on Aug 17, 2002 at 22:20 UTC
    I'm sure it's just a minor overlook, but the above code
    gives me an error: "Uninitialized value in print....". 
    #!/usr/bin/perl use warnings; use strict; my $file = "/etc/passwd"; open(PASSWD,"<$file") or die "Couldn't open $file: $!\n"; while (<PASSWD>){ print $_ unless eof PASSWD; }