I came across this line of code:
if( -f ) { ... }
-f appears to test whether the filename exists or not, but I am
-f
It tests whether the object specified by is a plain file (as opposed to binary, or being a directory, etc.).