Do you know where your variables are? | |
PerlMonks |
Should -f test return true for symlinks ? [RESOLVED]by Bloodnok (Vicar) |
on Oct 23, 2013 at 13:14 UTC ( [id://1059303]=perlquestion: print w/replies, xml ) | Need Help?? |
Bloodnok has asked for the wisdom of the Perl Monks concerning the following question:
G'day most revered brethren ,
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 ? 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 ?
A user level that continues to overstate my experience :-))
Back to
Seekers of Perl Wisdom
|
|