Managing and Navigating Directories

Just as you can work with files inside Perl as you might in a shell or command line, you can also navigate around your file system and manage directories (or folders, depending on your OS loyalties). You can find out the current directory, change the current directory, list the contents of that directory or some subset of its files, and create or remove the directories themselves. This section explains some of the nuances of performing these operations with Perl.

Navigating Directories

Each Perl script has a notion of a current working directory, that is, the directory from which the script was called (if you're used to working with command line–based systems, this is no surprise to you).To change the current ...

Get Sams Teach Yourself Perl in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.