while ($bytesread=read($filename,$buffer,1024)) { print OUTFILE $buffer; print "the thing is open"; }