Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: RE: File Input and Output

by turnstep (Parson)
on May 03, 2000 at 06:07 UTC ( [id://10024]=note: print w/replies, xml ) Need Help??


in reply to RE: File Input and Output
in thread File Input and Output

root just forgot that you don't need to escape less-than and greater-than signs inside <CODE> tags. Obviously, it should read:
while(<FILE>)

Replies are listed 'Best First'.
RE: RE: RE: RE: File Input and Output
by Anonymous Monk on May 05, 2000 at 05:31 UTC
    So, in summary, here's how you deal with open():

    #!/usr/bin/perl print"Gimmie a filename to examine: "; $filename=<STDIN>; open(FILE,$filename); while(<FILE>) { chomp; print "Found $_ in $filename" } close FILEDESC;
      Actually, it should be:
      print "Gimme a filename to examine: "; chop($filename=<STDIN>); ## Not many filenames have a newline... open(FILE, $filename) || die "Could not open $filename: $!\n"; while(<FILE>) { chomp; print "Found $_ in $filename\n" ## Need a newline here! } close(FILE); ## not FILEDESC...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2024-04-23 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found