#!/use/bin/perl $path_to_file1 = "adminhelp.pdf"; $path_to_newfile = "hello_world.out"; # start displaying the HTML page print "Content-type: text/html\n\n"; print "\r\n"; print "\r\n"; open (READFILE, "$path_to_file1") || &errorfunc("Couldn't open the file [$path_to_file1] to read."); print "The file [$path_to_file1] was opened for reading
"; ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat $path_to_file1; print "The size of file [$path_to_file1] is $size
"; open (WRITEFILE, ">$path_to_newfile") || &errorfunc("Couldn't open the file [$path_to_newfile] to write."); print "The file [$path_to_newfile] was opened for writing
"; binmode READFILE; while (read READFILE, $buf, 16384) { print <
Finished copying from [$path_to_file1] to [$path_to_newfile]
"; print "

"; exit;