Bloodnok has asked for the wisdom of the Perl Monks concerning the following question:
My reading of the file test operators perldoc (perl v5.14.2 on 32 bit Linux) suggests that the -f test will return true iff the file being tested is a regular file. However, when recently putting this to the test, I observed unexpected behaviour when run against a sym link - the following code is a simple demo of, what I consider to be, the problemmatic behaviour ...
As you see, -f returns a true value for the sym link which, IMO, is most definitely not a regular file; So the question is: is it my reading of perldoc or is it actually errant behaviour ?$ file file file: empty $ file link link: symbolic link to `file' $ $ perl -e 'printf "%d%d%d%d\n", -f "file", -f "link", -l "file", -l "l +ink"' 1101
I thank you in advance in anticipation of your consideration of the above.
UPDATE: As was suggested by choroba, it seems, on AIX, Solaris & Linux at least, as though symlinks are indeed followed .. and the same holds true for the -f and -d operators in the shell ... which begs the question: what on earth is the point of the -follow option to the find(1) command ?