Dr. Dobb's Journal February 1998
use stdio; sub filecopy { my ($source,$target) = @_; my $f1 = stdio::fopen($source,"r"); my $f2 = stdio::fopen($target,"w"); my $buffer = stdio::malloc(8192); my $nbytes = stdio::fread($buffer,1,8192,$f1); while ($nbytes > 0) { stdio::fwrite($buffer,1,8192,$f2); $nbytes = stdio::fread($buffer,1,8192,$f1); } stdio::free($buffer); stdio::fclose($f1); stdio::fclose($f2); }