in reply to File I/O Help
This way, we only print out the mimetype header once per file, and it's more Perlish this way. You might use binmode if you're going to serve something other than plain text files on a Unix OS. (Hey, be flexible!) Also, this has some error checking.open(FILE, "<wrfile.txt") || die "Can't open file for reading: $!"; print "Content-type: text/html\n\n"; # binmode FILE; print while <FILE>; close(FILE);
|
|---|