Programming and accessibility tips

from the Cynthia Network

Perl »

Test the status of files and directories in Perl

Perl offers functions (with flag syntax) for testing the status of files and directories. For instance, a file object name (which applies to plaiin files as well as directories) may be verified to exists with the function -e name. -e is a function taking name as its single argument. The output of -e is either TRUE or FALSE. If name is a plain file (not a directory and not a link) then the following functions will return the fize of the file name in bytes:

-s name

Here is a list of all file tests supported by Perl.

Computer science help

Programming

User

By Bill Hollingsworth
© 2016 by Cynsight, LLC.
Cynthia™ is a trademark of Cynsight, LLC.

^