Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Problems? Is your data what you think it is?
 
PerlMonks  

RE: RE: RE: RE: File Input and Output

by Anonymous Monk
on May 05, 2000 at 01:31 UTC ( [id://10297]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

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;

Replies are listed 'Best First'.
RE: RE: RE: RE: RE: File Input and Output
by turnstep (Parson) on May 05, 2000 at 02:46 UTC
    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://10297]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.