13.4 Making and Removing Directories
You probably couldn't have made it this far (on a UNIX system, anyway) without knowing about the
mkdir
(1) command, which makes directories that hold other filenames and other directories. Perl's equivalent is the
mkdir("gravelpit",0777) || die "cannot mkdir gravelpit: $!"; The UNIX rmdir (1) command removes empty directories; you'll find a Perl equivalent with the same name. Here's how to make Fred unemployed: rmdir("gravelpit") || die "cannot rmdir gravelpit: $!"; Although these Perl operators take advantage of the same-named system calls, they'll work even on systems without those system calls (albeit a bit slower). Perl calls the mkdir and rmdir utilities automatically for you (or whatever they're called on your system). Strike one blow in the name of portability! |
|