Beginning Perl for Bioinformaticians:
It seems that this book has nothing on this subject.
Chapter 13; p. 174-176, p. 182-184
Chapter 14; p. 192-193, p. 197 bottom - 199
Notes on mkdir, rmdir, chdir, rename,
unlink, chmod and system.
mkdir, which creates directories, rmdir, which removes
empty directories, chdir, which go to the given directory,
rename, which renames or moves files/directories, unlink
which deletes files, chmod, which changes permissions on
files/directories, system which submits jobs to the operating
system and finally backticks/backquotes which does the same but retains the
output from the job.
Necessary files to complete this exercise
To download the files to your system, just press the Shift key while
you left click on the blue link. Follow the instructions.
We have reused some of the files from earlier exercises.
You can play around with these files as much as you like. If you change or
destroy them, just download them again.
Remember to write #!/usr/bin/perl on the first line of
To print in the K-bar use: lpr -Pkps1 <filename>
Also, when invoking Netscape, do like this: netscape -ncols 64 &
All the following exercises have to be done in Perl
- These exercises are the same as the Unix exercises in lesson 1.
This time you will do the same just in Perl. If you prefer, you
can make one or two long programs, which does all this. Remember,
you can use unix commands, they just have to be called from Perl.
However, you should not use system calls to mv or cp.
- First list the files in the directory.
- Copy ex1.acc to myfile.acc.
- Copy ex1.dat to myfile.acc.
- Delete myfile.acc.
- Make a directory test and move the three files to it.
- Make a directory data and move the three files to that instead.
- Remove test directory.
- Change directory to data and confirm that you succeded.
- Make three new directories newtest - one inside the other,
like a russian doll.
- Move the data directory to the innermost newtest directory.
- Confirm that the three files are moved along with the data directory.
- Copy the three files to your home (your top directory).
- Remove all newtest directories and data in the with a single command