[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Copying files with MacPerl



On Thu, 24 Jul 1997 darrylc@foothills.eznet.com wrote:
|Is there a way to copy binary files from one folder to another in 
|MacPerl. I know it's easy with text files, but I expect a binary file 
|would require using the Mac's duplication function.

Nah, just use read and print in a loop. Only MS-DOS/Windows machines
have to worry about binary vs. text files. In fact, on Unix and Macs,
the following works just fine:

while (defined ($_ = <HANDLE>))
{
	print;
}

whether HANDLE is a filehandle to a text or binary file. The only caveat
being that sometimes you might be reading and printing single character
lines, and other times you may be reading and printing monstrously long
lines. That's why I'd recommend read when you're just copying a file--
you have control over the size of the chunks read.

Brian


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch