Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do i get EOF to work?

by vxp (Pilgrim)
on Aug 16, 2002 at 16:19 UTC ( [id://190696]=note: print w/replies, xml ) Need Help??


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 (Archbishop) 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; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://190696]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found