in reply to "-e" and "-d" switches
The '-x' switches (perldoc -f -x) test various file properties.
In your case, -d "filename" tests if "filename" is a directory. -e "filename" just checks if it exists. For example, -f "filename" will tell you if the file is a plainfile.
You can use these switches to get other information from files like age or last change.
Python's syntax succeeds in combining the mistakes of Lisp and Fortran. I do not contrue that as progress.
-- Larry Wall