From the course: Perl 5 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Working with binary files - Perl Tutorial
From the course: Perl 5 Essential Training
Working with binary files
- [Voiceover] Some operating systems make a distinction between text files and binary files. Windows does this. Unix based operating systems like Mac OS 10 do not. For this lesson I will be demonstrating on Windows. If you're on a Mac or another Unix based OS, you'll still want to follow along so you can understand this topic. Just keep in mind that you will not see this effect on your system. So here's a working copy of copyfile.pl from Chapter 12 of the exercise files. And you notice that we scroll down over here. I have file name one, train-station.jpg. File name two is copy.jpg. And you notice here train-station.jpg is there in the directory and copy.jpg is not. So I'm going to open file one, which is the train-station.jpg. I'm going to open that for read and I'm going to open file two which is the copy.jpg for write and it's the overwrite version of write. The new file version of write. And then I copy the file. I'm using the read function from IO file to read into the buffer…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.