Octavian Rasnita wrote:
> Hi all, > > I've tried the following script for reading a binary file, and just as a > test, I want to print it on another file and on the screen. > > But nothing is printed, no errors. Do you have any idea why? > > The script: > > #!c:\perl\bin\perl.exe You should turn on warnings: #!c:\perl\bin\perl.exe -w You should also consider : use strict; > print "Content-type: text/html\n\n"; > print "Parse completed<br>"; > > $file = "C:\\My Documents\\test3.cgi"; > > open(NEW, ">c:\\Program Files\\Apache Group\\Apache\\images"); You shouild test to make sure the file was successfully opened- see below. > binmode NEW; > while (read($file, $buffer, 1024)) { read takes a filehandle as the first argument. You're passing it the path to a file. Try something like: open(INPUT, "C:\\My Documents\\test3.cgi") || die "Can't open test3.cgi: $!"; while (read(INPUT, $buffer, 1024)) { print $buffer; print NEW $buffer; } > print $buffer; > print NEW $buffer; > } > close NEW; > > Thank you for any help. > I am trying to learn this but I just can't. It takes time, especially if Perl is your first programming language. But reading the docs helps. See perldoc -f read. Tagore Smith -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]